Skip to content

Commit

Permalink
fix(chart): closes fgpv-vpgf#379 fgpv-vpgf#359 and move control left
Browse files Browse the repository at this point in the history
  • Loading branch information
raviinder committed Feb 22, 2022
1 parent ac00384 commit cfcbd3b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions chart/src/chart-controls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export class ChartControls {
});

// add the control to panel header
panel.header._header.find('.rv-header-content')[0].after(this.compileTemplate(CHART_SELECT_TEMPLATE)[0]);
panel.header._header.find('.rv-header-content')[0].before(this.compileTemplate(CHART_SELECT_TEMPLATE)[0]);
}

/**
Expand All @@ -85,7 +85,8 @@ export class ChartControls {
* @param {Number} selectedLabel selected label
*/
private createChart(selectedChart: string, selectedLabel: [number]): void {
const item = JSON.parse(JSON.stringify(ChartParser.getItem(selectedChart)));
const origItem = ChartParser.getItem(selectedChart);
const item = JSON.parse(JSON.stringify(origItem));
const colors = item.config.options.colors === '' ? ChartLoader.defaultColors : item.config.options.colors.split(';');
item.config.layers[0].data = item.config.layers[0].data.map((obj, i) => {
return ({ ...obj, color: colors[i] });
Expand All @@ -101,7 +102,7 @@ export class ChartControls {
// Display Label combo.
$('.rv-chart-label-select').css('display', 'block');
// Hide and show multi check / single item combo on the basis of items.
if (item.config.layers[0].data.length > 1) {
if (origItem.config.layers[0].data.length > 1) {
$('.multiple-select').css('display', 'block');
$('.single-select').css('display', 'none');
}
Expand Down
2 changes: 1 addition & 1 deletion chart/src/chart-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ export class ChartParser {
item.config.layers[0].data = item.config.layers[0].data
.map((obj, i) => {
let key = this.ascii(obj.measure);
if (labelArrayLength === 0) {
if (labelArrayLength === 0 || item.config.layers[0].data.length === 1) {
self.selectedLabel.push(key);
self.selectedSingleLabel = key;
}
Expand Down
2 changes: 1 addition & 1 deletion chart/src/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
margin-left: 40px;

& #nouisliderX {
width: 97%;
width: 94.5%;
}
}
}
Expand Down

0 comments on commit cfcbd3b

Please sign in to comment.