@vizzly/dashboard 0.14.4-dev-fb756b8dda6220215f533bcdd3f270f5253906a8 → 0.14.4-dev-141913bcc9dced2a3f4a2c5c2d40ac36ba1bb900

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.
@@ -1,3 +1,3 @@
1
1
  import { LineChartRepresentation } from './types';
2
- export declare const ASSUMED_AVERAGE_CHAR_WIDTH = 8;
2
+ export declare const ASSUMED_AVERAGE_CHAR_WIDTH = 8.8;
3
3
  export declare const adjustTicks: (lineChartRepresentation: LineChartRepresentation, width: number) => LineChartRepresentation;
@@ -15,9 +15,7 @@ interface buildLineChartRepresentationArgs {
15
15
  defaultFormats: () => {
16
16
  [functionId: string]: string;
17
17
  };
18
- dimensions: QueryAttributes.Dimension[];
19
18
  goalLineAttributes: Component.GoalLine.Rule[];
20
- measures: QueryAttributes.Measure[];
21
19
  nullValue?: string;
22
20
  numberFormatOptions: {
23
21
  [id: string]: NumberFormatter;
@@ -35,5 +33,5 @@ interface buildLineChartRepresentationArgs {
35
33
  yAxisPrefix: string;
36
34
  approxYAxisLabelCount: number;
37
35
  }
38
- export declare const buildLineChartRepresentation: ({ axisTitles, colors, conditionalFormattingAttributes, dateTimeFormatOptions, defaultFormats, dimensions, goalLineAttributes, measures, nullValue, numberFormatOptions, order, pivotConfig, result, trendsAndForecasts, xAxisFormat, xAxisPostfix, xAxisPrefix, yAxisFormat, yAxisPostfix, yAxisPrefix, approxYAxisLabelCount, }: buildLineChartRepresentationArgs) => LineChartRepresentation;
36
+ export declare const buildLineChartRepresentation: ({ axisTitles, colors, conditionalFormattingAttributes, dateTimeFormatOptions, defaultFormats, goalLineAttributes, nullValue, numberFormatOptions, order, pivotConfig, result, trendsAndForecasts, xAxisFormat, xAxisPostfix, xAxisPrefix, yAxisFormat, yAxisPostfix, yAxisPrefix, approxYAxisLabelCount, }: buildLineChartRepresentationArgs) => LineChartRepresentation;
39
37
  export {};
@@ -1,8 +1,7 @@
1
1
  import { DataType } from '../Field/types';
2
+ import { FormattedResult } from '../Result/types';
2
3
  export declare const getMinAndMax: ({ data, key, dataType, }: {
3
- data: {
4
- [key: string]: string | number | Date | null;
5
- }[];
4
+ data: FormattedResult['contentMapped'];
6
5
  key: string | null;
7
6
  dataType: DataType;
8
7
  }) => {
@@ -1,26 +1,17 @@
1
- import { KeyId, Tick, Key, GoalLine } from './types';
1
+ import { KeyId, Tick, GoalLine } from './types';
2
2
  import { QueryAttributes } from '../QueryAttributes/types';
3
3
  import { DataType } from '../Field/types';
4
+ import { FormattedResult } from '../Result/types';
4
5
  declare type FormattingFunction = (value: any, nullValueAlias?: string) => string;
5
6
  interface getScaleAndTicksArgs {
6
- data: {
7
- [key: string]: Date | number | string | null;
8
- }[];
7
+ data: FormattedResult['contentMapped'];
9
8
  xKey: string | null;
10
9
  xScaleDataType: DataType;
11
- keys: {
12
- [key: KeyId]: Key;
13
- };
14
10
  yKeys: string[];
15
11
  nullValue: string | undefined;
16
12
  tickCountYAxis: number;
17
- fillMissingXTicks: boolean;
18
13
  formattingFunctionX: FormattingFunction;
19
14
  formattingFunctionY: FormattingFunction;
20
- xAxisPostfix: string;
21
- xAxisPrefix: string;
22
- yAxisPostfix: string;
23
- yAxisPrefix: string;
24
15
  order: QueryAttributes.Order[];
25
16
  goalLines: GoalLine[];
26
17
  }
@@ -46,5 +37,5 @@ interface getScaleAndTicksReturn {
46
37
  };
47
38
  };
48
39
  }
49
- export declare const getScaleAndTicks: ({ data, xKey, yKeys, xScaleDataType, nullValue, tickCountYAxis, fillMissingXTicks, formattingFunctionX, formattingFunctionY, xAxisPostfix, xAxisPrefix, yAxisPostfix, yAxisPrefix, order, keys, goalLines, }: getScaleAndTicksArgs) => getScaleAndTicksReturn;
40
+ export declare const getScaleAndTicks: ({ data, xKey, yKeys, xScaleDataType, nullValue, tickCountYAxis, formattingFunctionX, formattingFunctionY, order, goalLines, }: getScaleAndTicksArgs) => getScaleAndTicksReturn;
50
41
  export {};
@@ -37,7 +37,7 @@ export declare type Key = {
37
37
  };
38
38
  export declare type Tick<DataType> = {
39
39
  value: DataType;
40
- valueFormatted: string | null;
40
+ formattedValue: string | null;
41
41
  scaleValue: DataType | null;
42
42
  };
43
43
  export declare type LineChartRepresentation = {
@@ -59,12 +59,11 @@ export declare type LineChartRepresentation = {
59
59
  };
60
60
  export declare type DataItem = {
61
61
  value: number | string | null;
62
- valueAlias: string | null;
63
- valueFormatted: string | null;
62
+ formattedValue: string | null;
64
63
  };
65
64
  export declare type GoalLine = {
66
65
  value: number;
67
- valueFormatted: string | null;
66
+ formattedValue: string | null;
68
67
  color: string;
69
68
  strokeStyle?: 'dashed' | 'solid';
70
69
  strokeWidth: number;
@@ -2,4 +2,14 @@ import { QueryAttributes } from '../QueryAttributes/types';
2
2
  export declare type PivotConfig = {
3
3
  x: QueryAttributes.Field[];
4
4
  y: (QueryAttributes.Field | 'measures')[];
5
+ detailed: {
6
+ x: Array<{
7
+ field: string;
8
+ function: string;
9
+ }>;
10
+ y: Array<{
11
+ field: string;
12
+ function: string;
13
+ }>;
14
+ };
5
15
  };
@@ -0,0 +1,19 @@
1
+ import { PivotConfig } from '../PivotConfig/types';
2
+ import { FormattedResult } from './types';
3
+ import { DataType } from '@vizzly/sqlbuilder-public';
4
+ declare type Key = {
5
+ key: string;
6
+ keyFormatted: string;
7
+ dataType: DataType;
8
+ outputDataType: DataType;
9
+ };
10
+ declare type Returns = {
11
+ yKeys: string[];
12
+ xKeys: string[];
13
+ keys: {
14
+ [keyId: string]: Key;
15
+ };
16
+ seriesData: FormattedResult['contentMapped'];
17
+ };
18
+ export declare const formattedResultToSeries: (formattedResult: FormattedResult, pivotConfig: PivotConfig) => Returns;
19
+ export {};
@@ -24,6 +24,20 @@ export declare type FormattedResult = {
24
24
  value: any;
25
25
  formattedValue: string;
26
26
  }[][];
27
+ contentMapped: Array<{
28
+ [key: string]: {
29
+ value: any;
30
+ formattedValue: string;
31
+ };
32
+ }>;
27
33
  fields: Result.Field[];
28
34
  hasMoreResults?: boolean | null;
35
+ formatterFunc: (value: any, fieldParams: {
36
+ fieldId: Result['fields'][number]['fieldId'];
37
+ function: Result['fields'][number]['function'];
38
+ outputDataType: Result['fields'][number]['outputDataType'];
39
+ }) => {
40
+ value: any;
41
+ formattedValue: string;
42
+ };
29
43
  };
@@ -1,5 +1,6 @@
1
1
  import { DashboardBehaviour } from './types';
2
2
  import { QueryEngineConfig } from '../../../../shared-logic/src/QueryEngineConfig/types';
3
+ /** @deprecated - moved to number formatting option */
3
4
  export declare const FUNCTIONS_WHICH_USE_STRING_INSTEAD_OF_DATE: Array<keyof typeof defaultDateTimeFormatOptions>;
4
5
  export declare const defaultDateTimeFormatOptions: DashboardBehaviour['dateTimeFormatOptions'];
5
6
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vizzly/dashboard",
3
3
  "author": "james@vizzly.co",
4
- "version": "0.14.4-dev-fb756b8dda6220215f533bcdd3f270f5253906a8",
4
+ "version": "0.14.4-dev-141913bcc9dced2a3f4a2c5c2d40ac36ba1bb900",
5
5
  "source": "src/index.tsx",
6
6
  "types": "./dist/dashboard/src/index.d.ts",
7
7
  "main": "dist/index.js",
@@ -1,18 +0,0 @@
1
- import { DataItem, KeyId } from './types';
2
- interface getDataArgs {
3
- data: {
4
- [key: string]: Date | number | string | null;
5
- }[];
6
- xKey: KeyId | undefined;
7
- nullValue: string | undefined;
8
- xAxisPostfix: string;
9
- xAxisPrefix: string;
10
- yAxisPostfix: string;
11
- yAxisPrefix: string;
12
- formattingFunctionX: (value: any, noValueReplacement?: string) => string;
13
- formattingFunctionY: (value: any, noValueReplacement?: string) => string;
14
- }
15
- export declare const getData: ({ data, xKey, formattingFunctionX, formattingFunctionY, nullValue, xAxisPostfix, xAxisPrefix, yAxisPostfix, yAxisPrefix, }: getDataArgs) => {
16
- [keyId: string]: DataItem;
17
- }[];
18
- export {};
@@ -1,18 +0,0 @@
1
- import { KeyId, Key } from './types';
2
- import { QueryAttributes } from '../QueryAttributes/types';
3
- import { DataType } from '../Field/types';
4
- interface getXScaleArgs {
5
- xKey: string | null;
6
- xScaleDataType: DataType;
7
- order: QueryAttributes.Order[];
8
- keys: {
9
- [key: string]: Key;
10
- };
11
- }
12
- export declare const getXScale: ({ order, xKey, xScaleDataType, keys }: getXScaleArgs) => {
13
- dataType: DataType;
14
- key: KeyId | null;
15
- ordering: 'asc' | 'desc' | null;
16
- xScaleIsDimension: boolean;
17
- };
18
- export {};
@@ -1,34 +0,0 @@
1
- import { Result } from '../Result/types';
2
- import { PivotConfig } from '../PivotConfig/types';
3
- import { QueryAttributes } from '../QueryAttributes/types';
4
- import { DataType } from '../Field/types';
5
- import { DateTimeFormatter, NumberFormatter } from './types';
6
- interface prepareDataArgs {
7
- result: Result;
8
- pivotConfig: PivotConfig;
9
- measures: QueryAttributes.Measure[];
10
- dimensions: QueryAttributes.Dimension[];
11
- xKey: string;
12
- xKeyFunction: string;
13
- xKeyDataType: DataType;
14
- xKeyField: Result.Field | undefined;
15
- numberFormatOptions: {
16
- [id: string]: NumberFormatter;
17
- };
18
- dateTimeFormatOptions: {
19
- [id: string]: DateTimeFormatter;
20
- };
21
- defaultFormats: () => {
22
- [functionId: string]: string;
23
- };
24
- }
25
- export declare const prepareData: ({ result, pivotConfig, measures, dimensions, xKey, xKeyFunction, xKeyDataType, xKeyField, defaultFormats, numberFormatOptions, dateTimeFormatOptions, }: prepareDataArgs) => {
26
- data: {
27
- [x: string]: any;
28
- }[];
29
- xScaleDataType: "string" | "number" | "boolean" | "date_time";
30
- xScaleIsDateTimeAsNumber: boolean;
31
- yKeys: string[];
32
- keys: {};
33
- };
34
- export {};