mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
(core) Fix regression that caused Date/DateTime series to be treated as categorical data
Test Plan: Tested manually with a Date and DateTime column type. Reviewers: paulfitz Reviewed By: paulfitz Subscribers: paulfitz Differential Revision: https://phab.getgrist.com/D4305
This commit is contained in:
parent
61942f6f4b
commit
bb0213ecbe
@ -78,6 +78,9 @@ export function isNumericLike(col: ColumnRec, use: UseCB = unwrap) {
|
|||||||
return ['Numeric', 'Int', 'Any'].includes(colType);
|
return ['Numeric', 'Int', 'Any'].includes(colType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isCategoryType(pureType: string): boolean {
|
||||||
|
return !['Numeric', 'Int', 'Any', 'Date', 'DateTime'].includes(pureType);
|
||||||
|
}
|
||||||
|
|
||||||
interface ChartOptions {
|
interface ChartOptions {
|
||||||
multiseries?: boolean;
|
multiseries?: boolean;
|
||||||
@ -1125,7 +1128,7 @@ export const chartTypes: {[name: string]: ChartFunc} = {
|
|||||||
bar(series: Series[], options: ChartOptions): PlotData {
|
bar(series: Series[], options: ChartOptions): PlotData {
|
||||||
// If the X axis is not from numerical column, treat it as category.
|
// If the X axis is not from numerical column, treat it as category.
|
||||||
const data = basicPlot(series, options, {type: 'bar'});
|
const data = basicPlot(series, options, {type: 'bar'});
|
||||||
const useCategory = series[0]?.pureType && !['Numeric', 'Int', 'Any'].includes(series[0].pureType);
|
const useCategory = series[0]?.pureType && isCategoryType(series[0].pureType);
|
||||||
const xaxisName = options.orientation === 'h' ? 'yaxis' : 'xaxis';
|
const xaxisName = options.orientation === 'h' ? 'yaxis' : 'xaxis';
|
||||||
if (useCategory && data.layout && data.layout[xaxisName]) {
|
if (useCategory && data.layout && data.layout[xaxisName]) {
|
||||||
const axisConfig = data.layout[xaxisName]!;
|
const axisConfig = data.layout[xaxisName]!;
|
||||||
|
Loading…
Reference in New Issue
Block a user