mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-21 01:25:37 -05:00
fix the issue that chart axis's min/max value can't be zero (#18743)
* fix chart option issue * pr comment
This commit is contained in:
@@ -389,8 +389,9 @@ export class ChartView extends Disposable implements IPanelView {
|
||||
numberInput.setAriaLabel(option.label);
|
||||
numberInput.value = value || '';
|
||||
numberInput.onDidChange(e => {
|
||||
if (this._options[entry] !== Number(e)) {
|
||||
(this._options[entry] as any) = Number(e);
|
||||
if (this._options[entry] !== e) {
|
||||
// When user clears the input box, the value we get from the input box will be empty string.
|
||||
(this._options[entry] as any) = (e === '' ? undefined : Number(e));
|
||||
if (this.insight) {
|
||||
this.insight.options = this._options;
|
||||
}
|
||||
|
||||
@@ -208,11 +208,11 @@ export class Graph implements IInsight {
|
||||
}
|
||||
}];
|
||||
|
||||
if (options.xAxisMax) {
|
||||
if (options.xAxisMax !== undefined) {
|
||||
retval.scales = mixin(retval.scales, { xAxes: [{ ticks: { max: options.xAxisMax } }] }, true, customMixin);
|
||||
}
|
||||
|
||||
if (options.xAxisMin) {
|
||||
if (options.xAxisMin !== undefined) {
|
||||
retval.scales = mixin(retval.scales, { xAxes: [{ ticks: { min: options.xAxisMin } }] }, true, customMixin);
|
||||
}
|
||||
|
||||
@@ -230,17 +230,17 @@ export class Graph implements IInsight {
|
||||
}
|
||||
}];
|
||||
|
||||
if (options.yAxisMax) {
|
||||
if (options.yAxisMax !== undefined) {
|
||||
retval.scales = mixin(retval.scales, { yAxes: [{ ticks: { max: options.yAxisMax } }] }, true, customMixin);
|
||||
}
|
||||
|
||||
if (options.yAxisMin) {
|
||||
if (options.yAxisMin !== undefined) {
|
||||
retval.scales = mixin(retval.scales, { yAxes: [{ ticks: { min: options.yAxisMin } }] }, true, customMixin);
|
||||
}
|
||||
|
||||
if (this.originalType === ChartType.TimeSeries) {
|
||||
retval = mixin(retval, timeSeriesScales, true, customMixin);
|
||||
if (options.xAxisMax) {
|
||||
if (options.xAxisMax !== undefined) {
|
||||
retval = mixin(retval, {
|
||||
scales: {
|
||||
xAxes: [{
|
||||
@@ -252,7 +252,7 @@ export class Graph implements IInsight {
|
||||
}, true, customMixin);
|
||||
}
|
||||
|
||||
if (options.xAxisMin) {
|
||||
if (options.xAxisMin !== undefined) {
|
||||
retval = mixin(retval, {
|
||||
scales: {
|
||||
xAxes: [{
|
||||
|
||||
Reference in New Issue
Block a user