(core) mark first field as label (rather than x-axis) for two more chart types

Summary:
The reference to "X-AXIS" in scatter plot and Kaplan/Meier
configuration is misleading.

Test Plan: Extended a test

Reviewers: jarek

Reviewed By: jarek

Differential Revision: https://phab.getgrist.com/D3660
This commit is contained in:
Paul Fitzpatrick 2022-10-12 11:33:36 -04:00
parent db0b500197
commit 5b1fc20735

View File

@ -53,6 +53,10 @@ function isPieLike(chartType: string) {
return ['pie', 'donut'].includes(chartType); return ['pie', 'donut'].includes(chartType);
} }
function firstFieldIsLabels(chartType: string) {
return ['pie', 'donut', 'kaplan_meier', 'scatter'].includes(chartType);
}
export function isNumericOnly(chartType: string) { export function isNumericOnly(chartType: string) {
return ['bar', 'pie', 'donut', 'kaplan_meier', 'line', 'area', 'scatter'].includes(chartType); return ['bar', 'pie', 'donut', 'kaplan_meier', 'line', 'area', 'scatter'].includes(chartType);
} }
@ -560,7 +564,7 @@ export class ChartConfig extends GrainJSDisposable {
// The label to show for the first field in the axis configurator. // The label to show for the first field in the axis configurator.
private _firstFieldLabel = Computed.create(this, fromKo(this._section.chartTypeDef), ( private _firstFieldLabel = Computed.create(this, fromKo(this._section.chartTypeDef), (
(_use, chartType) => isPieLike(chartType) ? 'LABEL' : 'X-AXIS' (_use, chartType) => firstFieldIsLabels(chartType) ? 'LABEL' : 'X-AXIS'
)); ));
// A computed that returns `this._section.chartTypeDef` and that takes care of removing the group // A computed that returns `this._section.chartTypeDef` and that takes care of removing the group