@lightdash/common 0.1461.0 → 0.1462.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -145,6 +145,7 @@
145
145
  "mi",
146
146
  "usd",
147
147
  "gbp",
148
+ "jpy",
148
149
  "eur",
149
150
  "percent",
150
151
  "id"
@@ -311,6 +312,7 @@
311
312
  "km",
312
313
  "mi",
313
314
  "usd",
315
+ "jpy",
314
316
  "gbp",
315
317
  "eur",
316
318
  "percent",
@@ -396,6 +398,7 @@
396
398
  "km",
397
399
  "mi",
398
400
  "usd",
401
+ "jpy",
399
402
  "gbp",
400
403
  "eur",
401
404
  "percent",
@@ -596,6 +599,7 @@
596
599
  "km",
597
600
  "mi",
598
601
  "usd",
602
+ "jpy",
599
603
  "gbp",
600
604
  "eur",
601
605
  "percent",
@@ -3,7 +3,7 @@ import { type Organization } from '../types/organization';
3
3
  import { type RawResultRow } from '../types/results';
4
4
  import { ChartKind, type CartesianSeriesType } from '../types/savedCharts';
5
5
  import { type SemanticLayerQuery } from '../types/semanticLayer';
6
- import { VizIndexType, type PivotChartData, type PivotChartLayout, type VizCartesianChartConfig, type VizCartesianChartOptions } from './types';
6
+ import { type AxisSide, VizIndexType, type PivotChartData, type PivotChartLayout, type VizCartesianChartConfig, type VizCartesianChartOptions } from './types';
7
7
  import { type IResultsRunner } from './types/IResultsRunner';
8
8
  type CartesianChartKind = Extract<ChartKind, ChartKind.LINE | ChartKind.VERTICAL_BAR>;
9
9
  export declare class CartesianChartDataModel {
@@ -71,7 +71,7 @@ export type CartesianChartDisplay = {
71
71
  color?: string;
72
72
  type?: CartesianSeriesType.LINE | CartesianSeriesType.BAR;
73
73
  valueLabelPosition?: ValueLabelPositionOptions;
74
- whichYAxis?: number;
74
+ whichYAxis?: AxisSide;
75
75
  };
76
76
  };
77
77
  legend?: {
@@ -302,8 +302,12 @@ class CartesianChartDataModel {
302
302
  const leftYAxisSeriesReferences = [];
303
303
  const rightYAxisSeriesReferences = [];
304
304
  const series = transformedData.valuesColumns.map((seriesColumn, index) => {
305
- const seriesDisplay = Object.values(display?.series || {}).find((s) => s.yAxisIndex === index);
306
305
  const seriesColumnId = seriesColumn.pivotColumnName;
306
+ // NOTE: seriesColumnId is the post pivoted column name and we now store the display based on that.
307
+ // If there is no display object for the seriesColumnId, we also referenceField for compatibility with
308
+ // the old display object that stored display info by the field, not the ID.
309
+ const seriesDisplay = display?.series?.[seriesColumnId] ??
310
+ display?.series?.[seriesColumn.referenceField];
307
311
  const seriesColor = seriesDisplay?.color;
308
312
  const seriesValueLabelPosition = seriesDisplay?.valueLabelPosition;
309
313
  const seriesType = seriesDisplay?.type ?? defaultSeriesType;
@@ -24,6 +24,10 @@ export declare enum VizIndexType {
24
24
  TIME = "time",
25
25
  CATEGORY = "category"
26
26
  }
27
+ export declare enum AxisSide {
28
+ LEFT = 0,
29
+ RIGHT = 1
30
+ }
27
31
  export declare function getColumnAxisType(column: VizColumn): VizIndexType;
28
32
  export type VizIndexLayoutOptions = {
29
33
  axisType: VizIndexType;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isVizTableConfig = exports.isVizPieChartConfig = exports.isVizCartesianChartConfig = exports.isVizLineChartConfig = exports.isVizBarChartConfig = exports.isPivotChartLayout = exports.getColumnAxisType = exports.VizIndexType = exports.VIZ_DEFAULT_AGGREGATION = exports.vizAggregationOptions = exports.SortByDirection = exports.VizAggregationOptions = void 0;
3
+ exports.isVizTableConfig = exports.isVizPieChartConfig = exports.isVizCartesianChartConfig = exports.isVizLineChartConfig = exports.isVizBarChartConfig = exports.isPivotChartLayout = exports.getColumnAxisType = exports.AxisSide = exports.VizIndexType = exports.VIZ_DEFAULT_AGGREGATION = exports.vizAggregationOptions = exports.SortByDirection = exports.VizAggregationOptions = void 0;
4
4
  const field_1 = require("../../types/field");
5
5
  const savedCharts_1 = require("../../types/savedCharts");
6
6
  var VizAggregationOptions;
@@ -31,6 +31,11 @@ var VizIndexType;
31
31
  VizIndexType["TIME"] = "time";
32
32
  VizIndexType["CATEGORY"] = "category";
33
33
  })(VizIndexType = exports.VizIndexType || (exports.VizIndexType = {}));
34
+ var AxisSide;
35
+ (function (AxisSide) {
36
+ AxisSide[AxisSide["LEFT"] = 0] = "LEFT";
37
+ AxisSide[AxisSide["RIGHT"] = 1] = "RIGHT";
38
+ })(AxisSide = exports.AxisSide || (exports.AxisSide = {}));
34
39
  function getColumnAxisType(column) {
35
40
  switch (column.type) {
36
41
  case field_1.DimensionType.DATE:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightdash/common",
3
- "version": "0.1461.0",
3
+ "version": "0.1462.1",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [