Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: data chart scale grace #344

Merged
merged 1 commit into from
Mar 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions src/app/widget-config/chart-options/chart-options.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,6 @@ export class ChartOptionsComponent implements OnInit {
) { }

ngOnInit(): void {
if (this.startScaleAtZero.value) {
this.showDatasetMinimumValueLine.disable();
this.showDatasetMaximumValueLine.disable();
}

if (!this.showAverageData.value) {
this.trackAgainstAverage.disable();
}
Expand All @@ -80,18 +75,6 @@ export class ChartOptionsComponent implements OnInit {
this.setValueScaleOptionsControls(e.value);
}

public disableMinMaxLines(e: MatCheckboxChange): void {
if (e.checked) {
this.showDatasetMinimumValueLine.setValue(!e.checked);
this.showDatasetMaximumValueLine.setValue(!e.checked);
this.showDatasetMinimumValueLine.disable();
this.showDatasetMaximumValueLine.disable();
} else {
this.showDatasetMinimumValueLine.enable();
this.showDatasetMaximumValueLine.enable();
}
}

public enableTrackAgainstMovingAverage(e: MatCheckboxChange): void {
if (e.checked) {
this.trackAgainstAverage.enable();
Expand Down
15 changes: 10 additions & 5 deletions src/app/widgets/widget-data-chart/widget-data-chart.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export class WidgetDataChartComponent extends BaseWidgetComponent implements OnI
showDatasetAngleAverageValueLine: false,
showLabel: false,
showTimeScale: false,
startScaleAtZero: true,
startScaleAtZero: false,
verticalGraph: false,
showYScale: false,
yScaleSuggestedMin: null,
Expand Down Expand Up @@ -204,17 +204,22 @@ export class WidgetDataChartComponent extends BaseWidgetComponent implements OnI
suggestedMax: this.widgetProperties.config.enableMinMaxScaleLimit ? null : this.widgetProperties.config.yScaleSuggestedMax,
min: this.widgetProperties.config.enableMinMaxScaleLimit ? this.widgetProperties.config.yScaleMin : null,
max: this.widgetProperties.config.enableMinMaxScaleLimit ? this.widgetProperties.config.yScaleMax : null,
grace: "5%",
beginAtZero: this.widgetProperties.config.startScaleAtZero,
// grace: "5%",
title: {
display: false,
text: "Value Axis",
align: "center"
},
ticks: {
maxTicksLimit: 6
maxTicksLimit: 8,
precision: this.widgetProperties.config.numDecimal,
major: {
enabled: true,
}
},
grid: {
display: true
display: true,
}
}
}
Expand Down Expand Up @@ -252,7 +257,7 @@ export class WidgetDataChartComponent extends BaseWidgetComponent implements OnI
minimumLine: {
type: 'line',
scaleID: 'y',
display: this.widgetProperties.config.startScaleAtZero ? false : this.widgetProperties.config.showDatasetMinimumValueLine,
display: this.widgetProperties.config.showDatasetMinimumValueLine,
value: null,
drawTime: 'afterDatasetsDraw',
label: {
Expand Down