@milaboratories/graph-maker 1.1.67 → 1.1.69

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.
package/README.md CHANGED
@@ -12,19 +12,37 @@ import { GraphMaker } from '@milaboratories/graph-maker';
12
12
 
13
13
  const app = useApp();
14
14
  const frameRef = app.model.outputs.pFrame;
15
- const settings = ref<GraphMakerSettings>({
16
- chartType: 'discrete',
15
+
16
+ const state = ref<GraphMakerSettings>({
17
17
  template: 'box',
18
18
  title: 'My graph'
19
19
  });
20
+
21
+ const defaultOptions:PredefinedGraphOption<'discrete'>[] = [{
22
+ inputName: 'y',
23
+ selectedSource: {
24
+ kind: 'PColumn',
25
+ axesSpec: [...],
26
+ valueType: 'Int',
27
+ name: 'columnNameOfSomeYColumn',
28
+ }
29
+ }];
30
+
31
+ const graphMakerRef = useTemplateRef('graphMaker');
32
+ function reset() {
33
+ state.value = {...} // new graph state, empty or not;
34
+ graphMakerRef.value?.reset();
35
+ }
36
+
20
37
  </script>
21
38
 
22
39
  <template>
23
40
  <graph-maker
24
- v-if="platforma.pFrameDriver && frameRef && settings"
25
- v-model="settings"
26
- :p-frame-handle="frameRef"
27
- :p-frame-driver="platforma.pFrameDriver"
41
+ ref="graphMaker"
42
+ v-model="state"
43
+ chartType="discrete"
44
+ :pFrame="app.model.outputs.pFrame"
45
+ :default-options="defaultOptions"
28
46
  />
29
47
  </template>
30
48
  ```
@@ -218,6 +218,7 @@ export type LayersSettings = {
218
218
  export declare const DEFAULT_LAYERS_SETTINGS: () => LayersSettings;
219
219
  export declare function getDefaultLayersSettings(): LayersSettings;
220
220
  export declare function getInitialLayersSettings(initialSettings?: DeepPartial<LayersSettings>): LayersSettings;
221
+ export type Sorting = 'asc' | 'desc';
221
222
  export type AxesState = {
222
223
  title: {
223
224
  value: string;
@@ -236,6 +237,7 @@ export type AxesState = {
236
237
  ticks: boolean;
237
238
  scale: Scale;
238
239
  significantLinesStyle: LineType;
240
+ sorting: Sorting;
239
241
  };
240
242
  axisY: {
241
243
  titleMode: AxisTitleMode;
@@ -245,6 +247,7 @@ export type AxesState = {
245
247
  ticks: boolean;
246
248
  scale: Scale;
247
249
  significantLinesStyle: LineType;
250
+ sorting: Sorting;
248
251
  };
249
252
  legend: {};
250
253
  other: {
@@ -1,6 +1,7 @@
1
1
  import { GraphMakerState } from './types.ts';
2
2
  import { PFrameDriver } from '@platforma-sdk/model';
3
3
 
4
+ declare function reset(): void;
4
5
  declare function __VLS_template(): {
5
6
  titleLineSlot?(_: {}): any;
6
7
  };
@@ -263,7 +264,14 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
263
264
  readonlyInputs: {
264
265
  type: import('vue').PropType<("x" | "y" | "filters" | "tabBy" | "facetBy" | "tooltipContent" | "valueSize" | "valueColor")[]>;
265
266
  };
266
- }>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
267
+ }>, {
268
+ /**
269
+ reset() will update data-mapping, axis-settings, layers-settings with the state that is in v-model at the moment.
270
+ In other cases editing of v-model fields doesn't make any impact to graphs and interface.
271
+ Besides, after reset default-options will be applied again. You can use reset to apply new default-options.
272
+ */
273
+ reset: typeof reset;
274
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
267
275
  "tooltip-btn-click": (...args: any[]) => void;
268
276
  "delete-this-graph": (...args: any[]) => void;
269
277
  "update-lasso-polygon": (...args: any[]) => void;
@@ -257,6 +257,7 @@ export declare function createReactiveState(initialData: GraphMakerState, chartT
257
257
  ticks: boolean;
258
258
  scale: import('./types.ts').Scale;
259
259
  significantLinesStyle: import('./components/AesSettings/types').LineType;
260
+ sorting: import('./constantsCommon.ts').Sorting;
260
261
  };
261
262
  axisY: {
262
263
  titleMode: import('./types.ts').AxisTitleMode;
@@ -266,6 +267,7 @@ export declare function createReactiveState(initialData: GraphMakerState, chartT
266
267
  ticks: boolean;
267
268
  scale: import('./types.ts').Scale;
268
269
  significantLinesStyle: import('./components/AesSettings/types').LineType;
270
+ sorting: import('./constantsCommon.ts').Sorting;
269
271
  };
270
272
  legend: {};
271
273
  other: {
@@ -579,6 +581,7 @@ export declare function factoryStore(reactiveState: Reactive<ReactiveState>, dat
579
581
  ticks: boolean;
580
582
  scale: import('./types.ts').Scale;
581
583
  significantLinesStyle: import('./components/AesSettings/types').LineType;
584
+ sorting: import('./constantsCommon.ts').Sorting;
582
585
  };
583
586
  axisY: {
584
587
  titleMode: import('./types.ts').AxisTitleMode;
@@ -588,6 +591,7 @@ export declare function factoryStore(reactiveState: Reactive<ReactiveState>, dat
588
591
  ticks: boolean;
589
592
  scale: import('./types.ts').Scale;
590
593
  significantLinesStyle: import('./components/AesSettings/types').LineType;
594
+ sorting: import('./constantsCommon.ts').Sorting;
591
595
  };
592
596
  legend: {};
593
597
  other: {
@@ -650,6 +654,7 @@ export declare function factoryStore(reactiveState: Reactive<ReactiveState>, dat
650
654
  loading: {
651
655
  initialInputGuide: boolean;
652
656
  initialCharts: boolean;
657
+ initialDefaults: boolean;
653
658
  inputGuide: boolean;
654
659
  chartData: boolean;
655
660
  dendroTableData: boolean;
@@ -676,7 +681,7 @@ export declare function factoryStore(reactiveState: Reactive<ReactiveState>, dat
676
681
  readonlyInputs: ("label" | "height" | "size" | "x" | "y" | "value" | "lineColor" | "primaryGrouping" | "secondaryGrouping" | "grouping" | "filters" | "tabBy" | "facetBy" | "shape" | "tooltipContent" | "xGroupBy" | "yGroupBy" | "annotationsX" | "annotationsY" | "labels" | "tableContent" | "nodeColor" | "nodeShape" | "nodeSize" | "heatmapForSequence" | "heatmapAnnotation" | "heatmapAxis" | "heatmapGroup" | "valueSize" | "valueColor")[] | undefined;
677
682
  };
678
683
  export type Store = ComputedRef<ReturnType<typeof factoryStore>>;
679
- export declare function provideStore(initialState: GraphMakerState, dataStoreRef: Ref<DemoDataStore | null>, chartType: ChartType, defaultOptions: GraphMakerProps['defaultOptions'], fixedOptionsRef: Ref<GraphMakerProps['fixedOptions']>, dataColumnPredicate?: (spec: PColumnSpec) => boolean, readonlyInputs?: InputNamesByChartType[ChartType][]): ComputedRef<{
684
+ export declare function provideStore(initialState: GraphMakerState, dataStoreRef: Ref<DemoDataStore | null>, chartType: ChartType, defaultOptionsRef: Ref<GraphMakerProps['defaultOptions']>, fixedOptionsRef: Ref<GraphMakerProps['fixedOptions']>, dataColumnPredicate?: (spec: PColumnSpec) => boolean, readonlyInputs?: InputNamesByChartType[ChartType][]): ComputedRef<{
680
685
  reactive: {
681
686
  chartType: ChartType;
682
687
  template: import('./types.ts').LayersTemplate;
@@ -930,6 +935,7 @@ export declare function provideStore(initialState: GraphMakerState, dataStoreRef
930
935
  ticks: boolean;
931
936
  scale: import('./types.ts').Scale;
932
937
  significantLinesStyle: import('./components/AesSettings/types').LineType;
938
+ sorting: import('./constantsCommon.ts').Sorting;
933
939
  };
934
940
  axisY: {
935
941
  titleMode: import('./types.ts').AxisTitleMode;
@@ -939,6 +945,7 @@ export declare function provideStore(initialState: GraphMakerState, dataStoreRef
939
945
  ticks: boolean;
940
946
  scale: import('./types.ts').Scale;
941
947
  significantLinesStyle: import('./components/AesSettings/types').LineType;
948
+ sorting: import('./constantsCommon.ts').Sorting;
942
949
  };
943
950
  legend: {};
944
951
  other: {
@@ -1001,6 +1008,7 @@ export declare function provideStore(initialState: GraphMakerState, dataStoreRef
1001
1008
  loading: {
1002
1009
  initialInputGuide: boolean;
1003
1010
  initialCharts: boolean;
1011
+ initialDefaults: boolean;
1004
1012
  inputGuide: boolean;
1005
1013
  chartData: boolean;
1006
1014
  dendroTableData: boolean;
@@ -8,13 +8,22 @@ export type DeepPartial<T> = {
8
8
  [P in keyof T]?: Partial<T[P]>;
9
9
  };
10
10
  export type GraphMakerState = {
11
+ /** Editable title on the top */
11
12
  title: string;
13
+ /** 'box', 'violins', 'dots' etc, depends on chart type */
12
14
  template: LayersTemplate;
15
+ /** Optional part, used for data saving to ui-state; don't need to be set in initial settings,
16
+ it appears in settings after changes in user interface */
13
17
  currentTab?: FormKey | null;
18
+ /** Data-mapping state, use inner-generated keys to keep selected columns, use default-options prop to set defaults */
14
19
  optionsState?: InputState;
20
+ /** Saved settings of p-value (for discrete charts), trends (for scatterplot) */
15
21
  statisticsSettings?: DeepPartial<StatisticsState>;
22
+ /** Settings of grid, axes titles, facet positions, grouping order*/
16
23
  axesSettings?: DeepPartial<AxesState>;
24
+ /** Settings for every type of layer, aesthetics */
17
25
  layersSettings?: DeepPartial<LayersSettings>;
26
+ /** Saved palettes and color-mapping settings linked to columns/axes */
18
27
  dataBindAes?: Record<string, AestheticMappingCategorical>;
19
28
  };
20
29
  export type PredefinedGraphOption<T extends ChartType> = {