mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -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.setAriaLabel(option.label);
|
||||||
numberInput.value = value || '';
|
numberInput.value = value || '';
|
||||||
numberInput.onDidChange(e => {
|
numberInput.onDidChange(e => {
|
||||||
if (this._options[entry] !== Number(e)) {
|
if (this._options[entry] !== e) {
|
||||||
(this._options[entry] as any) = Number(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) {
|
if (this.insight) {
|
||||||
this.insight.options = this._options;
|
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);
|
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);
|
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);
|
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);
|
retval.scales = mixin(retval.scales, { yAxes: [{ ticks: { min: options.yAxisMin } }] }, true, customMixin);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.originalType === ChartType.TimeSeries) {
|
if (this.originalType === ChartType.TimeSeries) {
|
||||||
retval = mixin(retval, timeSeriesScales, true, customMixin);
|
retval = mixin(retval, timeSeriesScales, true, customMixin);
|
||||||
if (options.xAxisMax) {
|
if (options.xAxisMax !== undefined) {
|
||||||
retval = mixin(retval, {
|
retval = mixin(retval, {
|
||||||
scales: {
|
scales: {
|
||||||
xAxes: [{
|
xAxes: [{
|
||||||
@@ -252,7 +252,7 @@ export class Graph implements IInsight {
|
|||||||
}, true, customMixin);
|
}, true, customMixin);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.xAxisMin) {
|
if (options.xAxisMin !== undefined) {
|
||||||
retval = mixin(retval, {
|
retval = mixin(retval, {
|
||||||
scales: {
|
scales: {
|
||||||
xAxes: [{
|
xAxes: [{
|
||||||
|
|||||||
Reference in New Issue
Block a user