@sqlrooms/mosaic 0.29.0-rc.7 → 0.29.0-rc.8
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/LICENSE.md +2 -1
- package/README.md +134 -0
- package/dist/MosaicSlice.d.ts +1 -0
- package/dist/MosaicSlice.d.ts.map +1 -1
- package/dist/MosaicSlice.js.map +1 -1
- package/dist/VgPlotChart.d.ts.map +1 -1
- package/dist/VgPlotChart.js +9 -3
- package/dist/VgPlotChart.js.map +1 -1
- package/dist/ai/ai.d.ts +9 -4
- package/dist/ai/ai.d.ts.map +1 -1
- package/dist/ai/ai.js +91 -49
- package/dist/ai/ai.js.map +1 -1
- package/dist/ai.d.ts.map +1 -1
- package/dist/ai.js.map +1 -1
- package/dist/charts/MosaicChart.d.ts +3 -1
- package/dist/charts/MosaicChart.d.ts.map +1 -1
- package/dist/charts/MosaicChart.js +2 -2
- package/dist/charts/MosaicChart.js.map +1 -1
- package/dist/charts/MosaicChartError.d.ts +8 -2
- package/dist/charts/MosaicChartError.d.ts.map +1 -1
- package/dist/charts/MosaicChartError.js +29 -3
- package/dist/charts/MosaicChartError.js.map +1 -1
- package/dist/charts/MosaicChartSettingsButton.d.ts +15 -0
- package/dist/charts/MosaicChartSettingsButton.d.ts.map +1 -0
- package/dist/charts/MosaicChartSettingsButton.js +7 -0
- package/dist/charts/MosaicChartSettingsButton.js.map +1 -0
- package/dist/charts/MosaicChartView.d.ts +2 -0
- package/dist/charts/MosaicChartView.d.ts.map +1 -1
- package/dist/charts/MosaicChartView.js +20 -7
- package/dist/charts/MosaicChartView.js.map +1 -1
- package/dist/charts/chart-settings/MosaicChartSettings.d.ts.map +1 -1
- package/dist/charts/chart-settings/MosaicChartSettings.js +3 -3
- package/dist/charts/chart-settings/MosaicChartSettings.js.map +1 -1
- package/dist/charts/chart-settings/MosaicChartSettingsPanel.js +1 -1
- package/dist/charts/chart-settings/MosaicChartSettingsPanel.js.map +1 -1
- package/dist/charts/chart-settings/MosaicChartTypeSelector.d.ts.map +1 -1
- package/dist/charts/chart-settings/MosaicChartTypeSelector.js +11 -4
- package/dist/charts/chart-settings/MosaicChartTypeSelector.js.map +1 -1
- package/dist/charts/chart-types/base-types.d.ts +17 -6
- package/dist/charts/chart-types/base-types.d.ts.map +1 -1
- package/dist/charts/chart-types/base-types.js +3 -0
- package/dist/charts/chart-types/base-types.js.map +1 -1
- package/dist/charts/chart-types/box-plot/renderer/BoxPlotClient.d.ts.map +1 -1
- package/dist/charts/chart-types/box-plot/renderer/BoxPlotClient.js +3 -8
- package/dist/charts/chart-types/box-plot/renderer/BoxPlotClient.js.map +1 -1
- package/dist/charts/chart-types/chart-config.d.ts +3 -1
- package/dist/charts/chart-types/chart-config.d.ts.map +1 -1
- package/dist/charts/chart-types/chart-config.js +2 -2
- package/dist/charts/chart-types/chart-config.js.map +1 -1
- package/dist/charts/chart-types/count-plot/spec.d.ts +2 -1
- package/dist/charts/chart-types/count-plot/spec.d.ts.map +1 -1
- package/dist/charts/chart-types/count-plot/spec.js +65 -34
- package/dist/charts/chart-types/count-plot/spec.js.map +1 -1
- package/dist/charts/chart-types/count-plot/tool.js +1 -1
- package/dist/charts/chart-types/count-plot/tool.js.map +1 -1
- package/dist/charts/chart-types/createDefaultChartTypes.js +2 -2
- package/dist/charts/chart-types/createDefaultChartTypes.js.map +1 -1
- package/dist/charts/chart-types/custom-spec/spec.d.ts +2 -1
- package/dist/charts/chart-types/custom-spec/spec.d.ts.map +1 -1
- package/dist/charts/chart-types/custom-spec/spec.js +16 -12
- package/dist/charts/chart-types/custom-spec/spec.js.map +1 -1
- package/dist/charts/chart-types/errors.d.ts +25 -0
- package/dist/charts/chart-types/errors.d.ts.map +1 -1
- package/dist/charts/chart-types/errors.js +38 -0
- package/dist/charts/chart-types/errors.js.map +1 -1
- package/dist/charts/chart-types/heatmap/spec.d.ts +2 -1
- package/dist/charts/chart-types/heatmap/spec.d.ts.map +1 -1
- package/dist/charts/chart-types/heatmap/spec.js +53 -21
- package/dist/charts/chart-types/heatmap/spec.js.map +1 -1
- package/dist/charts/chart-types/heatmap/tool.js +2 -2
- package/dist/charts/chart-types/heatmap/tool.js.map +1 -1
- package/dist/charts/chart-types/histogram/HistogramSettings.d.ts.map +1 -1
- package/dist/charts/chart-types/histogram/HistogramSettings.js +3 -1
- package/dist/charts/chart-types/histogram/HistogramSettings.js.map +1 -1
- package/dist/charts/chart-types/histogram/schema.d.ts +2 -0
- package/dist/charts/chart-types/histogram/schema.d.ts.map +1 -1
- package/dist/charts/chart-types/histogram/schema.js +1 -0
- package/dist/charts/chart-types/histogram/schema.js.map +1 -1
- package/dist/charts/chart-types/histogram/spec.d.ts +2 -1
- package/dist/charts/chart-types/histogram/spec.d.ts.map +1 -1
- package/dist/charts/chart-types/histogram/spec.js +50 -27
- package/dist/charts/chart-types/histogram/spec.js.map +1 -1
- package/dist/charts/chart-types/histogram/tool.d.ts +2 -0
- package/dist/charts/chart-types/histogram/tool.d.ts.map +1 -1
- package/dist/charts/chart-types/histogram/tool.js +1 -1
- package/dist/charts/chart-types/histogram/tool.js.map +1 -1
- package/dist/charts/chart-types/index.d.ts +4 -4
- package/dist/charts/chart-types/index.js +4 -4
- package/dist/charts/chart-types/index.js.map +1 -1
- package/dist/charts/chart-types/line-chart/LineChartSettings.d.ts.map +1 -1
- package/dist/charts/chart-types/line-chart/LineChartSettings.js +4 -13
- package/dist/charts/chart-types/line-chart/LineChartSettings.js.map +1 -1
- package/dist/charts/chart-types/line-chart/LineChartXFieldSelector.d.ts +7 -0
- package/dist/charts/chart-types/line-chart/LineChartXFieldSelector.d.ts.map +1 -0
- package/dist/charts/chart-types/line-chart/LineChartXFieldSelector.js +22 -0
- package/dist/charts/chart-types/line-chart/LineChartXFieldSelector.js.map +1 -0
- package/dist/charts/chart-types/line-chart/LineChartYFieldsSelector.d.ts +7 -0
- package/dist/charts/chart-types/line-chart/LineChartYFieldsSelector.d.ts.map +1 -0
- package/dist/charts/chart-types/line-chart/LineChartYFieldsSelector.js +42 -0
- package/dist/charts/chart-types/line-chart/LineChartYFieldsSelector.js.map +1 -0
- package/dist/charts/chart-types/line-chart/schema.d.ts +2 -0
- package/dist/charts/chart-types/line-chart/schema.d.ts.map +1 -1
- package/dist/charts/chart-types/line-chart/schema.js +5 -0
- package/dist/charts/chart-types/line-chart/schema.js.map +1 -1
- package/dist/charts/chart-types/line-chart/spec.d.ts +2 -1
- package/dist/charts/chart-types/line-chart/spec.d.ts.map +1 -1
- package/dist/charts/chart-types/line-chart/spec.js +97 -65
- package/dist/charts/chart-types/line-chart/spec.js.map +1 -1
- package/dist/charts/chart-types/line-chart/tool.d.ts +2 -0
- package/dist/charts/chart-types/line-chart/tool.d.ts.map +1 -1
- package/dist/charts/chart-types/line-chart/tool.js +1 -1
- package/dist/charts/chart-types/line-chart/tool.js.map +1 -1
- package/dist/charts/chart-types/line-chart/utils.d.ts +7 -0
- package/dist/charts/chart-types/line-chart/utils.d.ts.map +1 -0
- package/dist/charts/chart-types/line-chart/utils.js +17 -0
- package/dist/charts/chart-types/line-chart/utils.js.map +1 -0
- package/dist/charts/chart-types/mosaicChartTypes.d.ts +4 -2
- package/dist/charts/chart-types/mosaicChartTypes.d.ts.map +1 -1
- package/dist/charts/chart-types/mosaicChartTypes.js +2 -2
- package/dist/charts/chart-types/mosaicChartTypes.js.map +1 -1
- package/dist/charts/chart-types/scatter-plot/ScatterPlotSettings.d.ts +3 -0
- package/dist/charts/chart-types/scatter-plot/ScatterPlotSettings.d.ts.map +1 -0
- package/dist/charts/chart-types/{bubble-chart/BubbleChartSettings.js → scatter-plot/ScatterPlotSettings.js} +4 -4
- package/dist/charts/chart-types/scatter-plot/ScatterPlotSettings.js.map +1 -0
- package/dist/charts/chart-types/scatter-plot/definition.d.ts +4 -0
- package/dist/charts/chart-types/scatter-plot/definition.d.ts.map +1 -0
- package/dist/charts/chart-types/scatter-plot/definition.js +24 -0
- package/dist/charts/chart-types/scatter-plot/definition.js.map +1 -0
- package/dist/charts/chart-types/{bubble-chart → scatter-plot}/schema.d.ts +5 -5
- package/dist/charts/chart-types/scatter-plot/schema.d.ts.map +1 -0
- package/dist/charts/chart-types/{bubble-chart → scatter-plot}/schema.js +5 -5
- package/dist/charts/chart-types/scatter-plot/schema.js.map +1 -0
- package/dist/charts/chart-types/scatter-plot/spec.d.ts +5 -0
- package/dist/charts/chart-types/scatter-plot/spec.d.ts.map +1 -0
- package/dist/charts/chart-types/scatter-plot/spec.js +81 -0
- package/dist/charts/chart-types/scatter-plot/spec.js.map +1 -0
- package/dist/charts/chart-types/{bubble-chart → scatter-plot}/tool.d.ts +3 -3
- package/dist/charts/chart-types/{bubble-chart → scatter-plot}/tool.d.ts.map +1 -1
- package/dist/charts/chart-types/{bubble-chart → scatter-plot}/tool.js +17 -13
- package/dist/charts/chart-types/scatter-plot/tool.js.map +1 -0
- package/dist/charts/dashboard/MosaicDashboardChartHeaderActions.d.ts.map +1 -1
- package/dist/charts/dashboard/MosaicDashboardChartHeaderActions.js +12 -5
- package/dist/charts/dashboard/MosaicDashboardChartHeaderActions.js.map +1 -1
- package/dist/charts/dashboard/MosaicDashboardChartRenderer.d.ts.map +1 -1
- package/dist/charts/dashboard/MosaicDashboardChartRenderer.js +2 -2
- package/dist/charts/dashboard/MosaicDashboardChartRenderer.js.map +1 -1
- package/dist/charts/useChartDataPolicy.d.ts.map +1 -1
- package/dist/charts/useChartDataPolicy.js +2 -1
- package/dist/charts/useChartDataPolicy.js.map +1 -1
- package/dist/charts/useChartPanelClients.d.ts +8 -0
- package/dist/charts/useChartPanelClients.d.ts.map +1 -0
- package/dist/charts/useChartPanelClients.js +22 -0
- package/dist/charts/useChartPanelClients.js.map +1 -0
- package/dist/charts/useMosaicChartRenderContext.d.ts +2 -3
- package/dist/charts/useMosaicChartRenderContext.d.ts.map +1 -1
- package/dist/charts/useMosaicChartRenderContext.js +15 -15
- package/dist/charts/useMosaicChartRenderContext.js.map +1 -1
- package/dist/charts/worksheet/ChartBlockHeader.d.ts.map +1 -1
- package/dist/charts/worksheet/ChartBlockHeader.js +4 -3
- package/dist/charts/worksheet/ChartBlockHeader.js.map +1 -1
- package/dist/charts/worksheet/ChartBlockRenderer.d.ts.map +1 -1
- package/dist/charts/worksheet/ChartBlockRenderer.js +3 -13
- package/dist/charts/worksheet/ChartBlockRenderer.js.map +1 -1
- package/dist/column-types-utils.d.ts.map +1 -1
- package/dist/column-types-utils.js +12 -4
- package/dist/column-types-utils.js.map +1 -1
- package/dist/components/AggregationSelector.d.ts.map +1 -1
- package/dist/components/AggregationSelector.js +9 -2
- package/dist/components/AggregationSelector.js.map +1 -1
- package/dist/components/BlockCaptionEditor.d.ts +20 -0
- package/dist/components/BlockCaptionEditor.d.ts.map +1 -0
- package/dist/components/BlockCaptionEditor.js +15 -0
- package/dist/components/BlockCaptionEditor.js.map +1 -0
- package/dist/components/ColorSelector.d.ts +12 -0
- package/dist/components/ColorSelector.d.ts.map +1 -0
- package/dist/components/ColorSelector.js +14 -0
- package/dist/components/ColorSelector.js.map +1 -0
- package/dist/components/ColumnSelector.d.ts +1 -0
- package/dist/components/ColumnSelector.d.ts.map +1 -1
- package/dist/components/ColumnSelector.js +2 -2
- package/dist/components/ColumnSelector.js.map +1 -1
- package/dist/components/Combobox.d.ts +45 -0
- package/dist/components/Combobox.d.ts.map +1 -0
- package/dist/components/Combobox.js +58 -0
- package/dist/components/Combobox.js.map +1 -0
- package/dist/components/FieldSelectorInput.d.ts +1 -0
- package/dist/components/FieldSelectorInput.d.ts.map +1 -1
- package/dist/components/FieldSelectorInput.js +4 -9
- package/dist/components/FieldSelectorInput.js.map +1 -1
- package/dist/components/MultiFieldSelector.d.ts +4 -1
- package/dist/components/MultiFieldSelector.d.ts.map +1 -1
- package/dist/components/MultiFieldSelector.js +4 -13
- package/dist/components/MultiFieldSelector.js.map +1 -1
- package/dist/components/TemporalGranularitySelector.d.ts.map +1 -1
- package/dist/components/TemporalGranularitySelector.js +13 -9
- package/dist/components/TemporalGranularitySelector.js.map +1 -1
- package/dist/components/useCombobox.d.ts +23 -0
- package/dist/components/useCombobox.d.ts.map +1 -0
- package/dist/components/useCombobox.js +26 -0
- package/dist/components/useCombobox.js.map +1 -0
- package/dist/constants/chart-colors.d.ts +3 -0
- package/dist/constants/chart-colors.d.ts.map +1 -0
- package/dist/constants/chart-colors.js +5 -0
- package/dist/constants/chart-colors.js.map +1 -0
- package/dist/dashboard/DefaultMosaicDashboardBlock.d.ts +2 -1
- package/dist/dashboard/DefaultMosaicDashboardBlock.d.ts.map +1 -1
- package/dist/dashboard/DefaultMosaicDashboardBlock.js +1 -1
- package/dist/dashboard/DefaultMosaicDashboardBlock.js.map +1 -1
- package/dist/dashboard/MosaicDashboardSlice.d.ts +22 -4
- package/dist/dashboard/MosaicDashboardSlice.d.ts.map +1 -1
- package/dist/dashboard/MosaicDashboardSlice.js +55 -0
- package/dist/dashboard/MosaicDashboardSlice.js.map +1 -1
- package/dist/dashboard/components/ResetFiltersButton.d.ts +14 -0
- package/dist/dashboard/components/ResetFiltersButton.d.ts.map +1 -0
- package/dist/dashboard/components/ResetFiltersButton.js +15 -0
- package/dist/dashboard/components/ResetFiltersButton.js.map +1 -0
- package/dist/dashboard/dashboard-types.d.ts +9 -3
- package/dist/dashboard/dashboard-types.d.ts.map +1 -1
- package/dist/dashboard/hooks/useDashboardResetFilters.d.ts +14 -0
- package/dist/dashboard/hooks/useDashboardResetFilters.d.ts.map +1 -0
- package/dist/dashboard/hooks/useDashboardResetFilters.js +39 -0
- package/dist/dashboard/hooks/useDashboardResetFilters.js.map +1 -0
- package/dist/dashboard/hooks/usePanelResetFilters.d.ts +16 -0
- package/dist/dashboard/hooks/usePanelResetFilters.d.ts.map +1 -0
- package/dist/dashboard/hooks/usePanelResetFilters.js +47 -0
- package/dist/dashboard/hooks/usePanelResetFilters.js.map +1 -0
- package/dist/dashboard/toolbar/MosaicDashboardAddPanelDropdown.d.ts.map +1 -1
- package/dist/dashboard/toolbar/MosaicDashboardAddPanelDropdown.js +3 -3
- package/dist/dashboard/toolbar/MosaicDashboardAddPanelDropdown.js.map +1 -1
- package/dist/dashboard/toolbar/MosaicDashboardDataTableSelector.d.ts +7 -0
- package/dist/dashboard/toolbar/MosaicDashboardDataTableSelector.d.ts.map +1 -0
- package/dist/dashboard/toolbar/MosaicDashboardDataTableSelector.js +18 -0
- package/dist/dashboard/toolbar/MosaicDashboardDataTableSelector.js.map +1 -0
- package/dist/dashboard/toolbar/MosaicDashboardResetFiltersButton.d.ts.map +1 -1
- package/dist/dashboard/toolbar/MosaicDashboardResetFiltersButton.js +4 -32
- package/dist/dashboard/toolbar/MosaicDashboardResetFiltersButton.js.map +1 -1
- package/dist/dashboard/toolbar/MosaicDashboardToolbar.d.ts +2 -2
- package/dist/dashboard/toolbar/MosaicDashboardToolbar.d.ts.map +1 -1
- package/dist/dashboard/toolbar/MosaicDashboardToolbar.js +12 -10
- package/dist/dashboard/toolbar/MosaicDashboardToolbar.js.map +1 -1
- package/dist/dashboard/usePanelClientRegistration.d.ts +7 -0
- package/dist/dashboard/usePanelClientRegistration.d.ts.map +1 -0
- package/dist/dashboard/usePanelClientRegistration.js +30 -0
- package/dist/dashboard/usePanelClientRegistration.js.map +1 -0
- package/dist/dashboard/usePanelClients.d.ts +7 -0
- package/dist/dashboard/usePanelClients.d.ts.map +1 -0
- package/dist/dashboard/usePanelClients.js +13 -0
- package/dist/dashboard/usePanelClients.js.map +1 -0
- package/dist/data-table-explorer/DataTableExplorer.d.ts +4 -2
- package/dist/data-table-explorer/DataTableExplorer.d.ts.map +1 -1
- package/dist/data-table-explorer/DataTableExplorer.js +4 -4
- package/dist/data-table-explorer/DataTableExplorer.js.map +1 -1
- package/dist/data-table-explorer/DataTableExplorerCategoryClient.d.ts.map +1 -1
- package/dist/data-table-explorer/DataTableExplorerCategoryClient.js +1 -0
- package/dist/data-table-explorer/DataTableExplorerCategoryClient.js.map +1 -1
- package/dist/data-table-explorer/createDataTableExplorerStore.d.ts +3 -0
- package/dist/data-table-explorer/createDataTableExplorerStore.d.ts.map +1 -1
- package/dist/data-table-explorer/createDataTableExplorerStore.js +6 -0
- package/dist/data-table-explorer/createDataTableExplorerStore.js.map +1 -1
- package/dist/data-table-explorer/dashboard/MosaicDashboardDataTableExplorerHeaderActions.d.ts +4 -0
- package/dist/data-table-explorer/dashboard/MosaicDashboardDataTableExplorerHeaderActions.d.ts.map +1 -0
- package/dist/data-table-explorer/dashboard/MosaicDashboardDataTableExplorerHeaderActions.js +13 -0
- package/dist/data-table-explorer/dashboard/MosaicDashboardDataTableExplorerHeaderActions.js.map +1 -0
- package/dist/data-table-explorer/dashboard/MosaicDashboardDataTableExplorerPanelRenderer.d.ts.map +1 -1
- package/dist/data-table-explorer/dashboard/MosaicDashboardDataTableExplorerPanelRenderer.js +22 -7
- package/dist/data-table-explorer/dashboard/MosaicDashboardDataTableExplorerPanelRenderer.js.map +1 -1
- package/dist/data-table-explorer/dashboard/useDataTableExplorerPanelClients.d.ts +13 -0
- package/dist/data-table-explorer/dashboard/useDataTableExplorerPanelClients.d.ts.map +1 -0
- package/dist/data-table-explorer/dashboard/useDataTableExplorerPanelClients.js +32 -0
- package/dist/data-table-explorer/dashboard/useDataTableExplorerPanelClients.js.map +1 -0
- package/dist/data-table-explorer/dataTableExplorerController.d.ts +5 -1
- package/dist/data-table-explorer/dataTableExplorerController.d.ts.map +1 -1
- package/dist/data-table-explorer/dataTableExplorerController.js +5 -2
- package/dist/data-table-explorer/dataTableExplorerController.js.map +1 -1
- package/dist/data-table-explorer/hooks/useDataTableExplorerColumns.d.ts +12 -0
- package/dist/data-table-explorer/hooks/useDataTableExplorerColumns.d.ts.map +1 -0
- package/dist/data-table-explorer/hooks/useDataTableExplorerColumns.js +19 -0
- package/dist/data-table-explorer/hooks/useDataTableExplorerColumns.js.map +1 -0
- package/dist/data-table-explorer/hooks/useDataTableExplorerLifecycles.d.ts +30 -0
- package/dist/data-table-explorer/hooks/useDataTableExplorerLifecycles.d.ts.map +1 -0
- package/dist/data-table-explorer/hooks/useDataTableExplorerLifecycles.js +120 -0
- package/dist/data-table-explorer/hooks/useDataTableExplorerLifecycles.js.map +1 -0
- package/dist/data-table-explorer/hooks/useDataTableExplorerQueryState.d.ts +28 -0
- package/dist/data-table-explorer/hooks/useDataTableExplorerQueryState.d.ts.map +1 -0
- package/dist/data-table-explorer/hooks/useDataTableExplorerQueryState.js +40 -0
- package/dist/data-table-explorer/hooks/useDataTableExplorerQueryState.js.map +1 -0
- package/dist/data-table-explorer/hooks/useDataTableExplorerSelection.d.ts +13 -0
- package/dist/data-table-explorer/hooks/useDataTableExplorerSelection.d.ts.map +1 -0
- package/dist/data-table-explorer/hooks/useDataTableExplorerSelection.js +40 -0
- package/dist/data-table-explorer/hooks/useDataTableExplorerSelection.js.map +1 -0
- package/dist/data-table-explorer/hooks/useDataTableExplorerStatus.d.ts +18 -0
- package/dist/data-table-explorer/hooks/useDataTableExplorerStatus.d.ts.map +1 -0
- package/dist/data-table-explorer/hooks/useDataTableExplorerStatus.js +23 -0
- package/dist/data-table-explorer/hooks/useDataTableExplorerStatus.js.map +1 -0
- package/dist/data-table-explorer/hooks/useDataTableExplorerStoreState.d.ts +27 -0
- package/dist/data-table-explorer/hooks/useDataTableExplorerStoreState.d.ts.map +1 -0
- package/dist/data-table-explorer/hooks/useDataTableExplorerStoreState.js +28 -0
- package/dist/data-table-explorer/hooks/useDataTableExplorerStoreState.js.map +1 -0
- package/dist/data-table-explorer/hooks/useDataTableExplorerVisiblePage.d.ts +15 -0
- package/dist/data-table-explorer/hooks/useDataTableExplorerVisiblePage.d.ts.map +1 -0
- package/dist/data-table-explorer/hooks/useDataTableExplorerVisiblePage.js +21 -0
- package/dist/data-table-explorer/hooks/useDataTableExplorerVisiblePage.js.map +1 -0
- package/dist/data-table-explorer/types.d.ts +6 -3
- package/dist/data-table-explorer/types.d.ts.map +1 -1
- package/dist/data-table-explorer/types.js.map +1 -1
- package/dist/data-table-explorer/useDataTableExplorer.d.ts.map +1 -1
- package/dist/data-table-explorer/useDataTableExplorer.js +12 -275
- package/dist/data-table-explorer/useDataTableExplorer.js.map +1 -1
- package/dist/data-table-explorer/worksheet/DataTableBlockHeader.d.ts +1 -0
- package/dist/data-table-explorer/worksheet/DataTableBlockHeader.d.ts.map +1 -1
- package/dist/data-table-explorer/worksheet/DataTableBlockHeader.js +4 -2
- package/dist/data-table-explorer/worksheet/DataTableBlockHeader.js.map +1 -1
- package/dist/data-table-explorer/worksheet/DataTableBlockRenderer.d.ts.map +1 -1
- package/dist/data-table-explorer/worksheet/DataTableBlockRenderer.js +3 -3
- package/dist/data-table-explorer/worksheet/DataTableBlockRenderer.js.map +1 -1
- package/dist/index.d.ts +8 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/dist/useVgPlotChartRender.d.ts.map +1 -1
- package/dist/useVgPlotChartRender.js +125 -24
- package/dist/useVgPlotChartRender.js.map +1 -1
- package/dist/useVgPlotChartRetention.d.ts +11 -0
- package/dist/useVgPlotChartRetention.d.ts.map +1 -1
- package/dist/useVgPlotChartRetention.js.map +1 -1
- package/package.json +14 -14
- package/dist/charts/chart-types/bubble-chart/BubbleChartSettings.d.ts +0 -3
- package/dist/charts/chart-types/bubble-chart/BubbleChartSettings.d.ts.map +0 -1
- package/dist/charts/chart-types/bubble-chart/BubbleChartSettings.js.map +0 -1
- package/dist/charts/chart-types/bubble-chart/definition.d.ts +0 -4
- package/dist/charts/chart-types/bubble-chart/definition.d.ts.map +0 -1
- package/dist/charts/chart-types/bubble-chart/definition.js +0 -24
- package/dist/charts/chart-types/bubble-chart/definition.js.map +0 -1
- package/dist/charts/chart-types/bubble-chart/schema.d.ts.map +0 -1
- package/dist/charts/chart-types/bubble-chart/schema.js.map +0 -1
- package/dist/charts/chart-types/bubble-chart/spec.d.ts +0 -4
- package/dist/charts/chart-types/bubble-chart/spec.d.ts.map +0 -1
- package/dist/charts/chart-types/bubble-chart/spec.js +0 -31
- package/dist/charts/chart-types/bubble-chart/spec.js.map +0 -1
- package/dist/charts/chart-types/bubble-chart/tool.js.map +0 -1
- package/dist/hooks/useDataTable.d.ts +0 -3
- package/dist/hooks/useDataTable.d.ts.map +0 -1
- package/dist/hooks/useDataTable.js +0 -28
- package/dist/hooks/useDataTable.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool.js","sourceRoot":"","sources":["../../../../src/charts/chart-types/heatmap/tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,IAAI,CAAC;AAExB,OAAO,EAAC,oBAAoB,EAAC,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAC,uBAAuB,EAAC,MAAM,0BAA0B,CAAC;AAEjE,OAAO,EAAC,oBAAoB,EAAC,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAC,oBAAoB,EAAC,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAC,wBAAwB,EAAC,MAAM,0BAA0B,CAAC;AAElE,MAAM,CAAC,MAAM,qBAAqB,GAAG,uBAAuB,CAAC,MAAM,CAAC;IAClE,QAAQ,EAAE,oBAAoB,CAAC,QAAQ,EAAE;CAC1C,CAAC,CAAC;AAIH,MAAM,UAAU,mBAAmB,CAAC,IAAuB;IACzD,OAAO,IAAI,CAAC;QACV,WAAW,EAAE;;;;;uCAKsB,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC;;
|
|
1
|
+
{"version":3,"file":"tool.js","sourceRoot":"","sources":["../../../../src/charts/chart-types/heatmap/tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,IAAI,CAAC;AAExB,OAAO,EAAC,oBAAoB,EAAC,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAC,uBAAuB,EAAC,MAAM,0BAA0B,CAAC;AAEjE,OAAO,EAAC,oBAAoB,EAAC,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAC,oBAAoB,EAAC,MAAM,6BAA6B,CAAC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AAC,CAAC,EAAE;wBAC1D,CAAC,CAAC,SAAS;oBACf,MAAM,EAAE;wBACN,SAAS,EAAE,SAAS;wBACpB,QAAQ,EAAE,MAAM,CAAC,QAAQ;qBAC1B;iBACF,CAAC,CAAC;gBAEH,OAAO;oBACL,SAAS,EAAE;wBACT,OAAO,EAAE,IAAI;wBACb,OAAO,EAAE,MAAM,CAAC,OAAO;4BACrB,CAAC,CAAC,oBAAoB,MAAM,CAAC,KAAK,IAAI;4BACtC,CAAC,CAAC,oBAAoB,MAAM,CAAC,KAAK,IAAI;wBACxC,IAAI,EAAE,MAAM;qBACb;iBACF,CAAC;YACJ,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO;oBACL,SAAS,EAAE;wBACT,OAAO,EAAE,KAAK;wBACd,YAAY,EACV,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;qBACzD;iBACF,CAAC;YACJ,CAAC;QACH,CAAC;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {tool} from 'ai';\nimport {z} from 'zod';\nimport {HeatmapChartSettings} from './schema';\nimport {BaseChartToolParameters} from '../../../ai/tool-schemas';\nimport {type DashboardToolDeps} from '../base-types';\nimport {validateColumnExists} from '../../../ai/tool-validation';\nimport {NUMERIC_COLUMN_TYPES} from '../../../column-types-utils';\nimport {createOrUpdateChartPanel} from '../../../ai/tool-helpers';\n\nexport const HeatmapToolParameters = BaseChartToolParameters.extend({\n settings: HeatmapChartSettings.required(),\n});\n\nexport type HeatmapToolParams = z.infer<typeof HeatmapToolParameters>;\n\nexport function createHeatmapAiTool(deps: DashboardToolDeps) {\n return tool({\n description: `Heatmap: visualizes density or aggregated values across two dimensions using color intensity in a grid. Each cell color shows count/sum at that x,y position.\n\nUse when: user asks about \"heatmap\", \"density by X and Y\", \"activity by [category] and [category]\", \"intensity\", \"patterns across two dimensions\".\nExample queries: \"heatmap of population density by latitude and longitude\", \"temperature by elevation and month\", \"show building density by coordinates\", \"land use intensity by region and type\", \"feature distribution by grid cell\".\n\nRequired: x and y should be numeric (${NUMERIC_COLUMN_TYPES.join(', ')}) for creating the grid.\n\nNOTE: Heatmaps aggregate data into grid cells and compute density/counts, so they handle large datasets efficiently (no data point limit). Heatmaps are a good alternative when scatter charts would exceed ${deps.maxDataPoints.toLocaleString()} rows.\n\nTo UPDATE an existing heatmap: provide the panelId parameter. Otherwise creates new panel.\n\nBest for: large datasets with overlapping points, finding patterns/hotspots in 2D space, temporal patterns (hour×day), spatial density visualization.\n\nDo NOT use for: individual point plots (use scatter-plot), single variable distribution (use histogram), time trends (use line-chart).`,\n inputSchema: HeatmapToolParameters,\n execute: async (params, context) => {\n try {\n const artifactId = deps.resolveArtifact(\n params.artifactId,\n params.createArtifactIfMissing,\n context,\n );\n const {tableName, columns} = deps.resolveTable(\n artifactId,\n params.tableName,\n );\n\n // Validate settings\n\n validateColumnExists(\n params.settings.x,\n NUMERIC_COLUMN_TYPES,\n columns,\n 'x',\n );\n\n validateColumnExists(\n params.settings.y,\n NUMERIC_COLUMN_TYPES,\n columns,\n 'y',\n );\n\n const result = createOrUpdateChartPanel(deps, {\n panelId: params.panelId,\n dashboardId: artifactId,\n tableName,\n title:\n params.settings.x && params.settings.y\n ? `Heatmap - ${params.settings.x} vs ${params.settings.y}`\n : 'Heatmap',\n config: {\n chartType: 'heatmap',\n settings: params.settings,\n },\n });\n\n return {\n llmResult: {\n success: true,\n details: params.panelId\n ? `Updated heatmap \"${result.title}\".`\n : `Created heatmap \"${result.title}\".`,\n data: result,\n },\n };\n } catch (error) {\n return {\n llmResult: {\n success: false,\n errorMessage:\n error instanceof Error ? error.message : String(error),\n },\n };\n }\n },\n });\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HistogramSettings.d.ts","sourceRoot":"","sources":["../../../../src/charts/chart-types/histogram/HistogramSettings.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAE,EAAC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"HistogramSettings.d.ts","sourceRoot":"","sources":["../../../../src/charts/chart-types/histogram/HistogramSettings.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAE,EAAC,MAAM,OAAO,CAAC;AAY9B,eAAO,MAAM,0BAA0B,EAAE,EAkCxC,CAAC"}
|
|
@@ -2,10 +2,12 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Input } from '@sqlrooms/ui';
|
|
3
3
|
import { Field } from '../../../components/Field';
|
|
4
4
|
import { ColumnSelector } from '../../../components/ColumnSelector';
|
|
5
|
+
import { ColorSelector } from '../../../components/ColorSelector';
|
|
5
6
|
import { useMosaicChartSettingsContext } from '../../chart-settings/MosaicChartSettingsContext';
|
|
6
7
|
import { MIN_BINS_COUNT, MAX_BINS_COUNT, DEFAULT_BINS_COUNT } from './schema';
|
|
8
|
+
import { DEFAULT_CHART_COLORS, DEFAULT_CHART_FALLBACK_COLOR, } from '../../../constants/chart-colors';
|
|
7
9
|
export const HistogramSettingsComponent = () => {
|
|
8
10
|
const { onChangeConfig, config } = useMosaicChartSettingsContext('histogram');
|
|
9
|
-
return (_jsxs("div", { className: "space-y-4", children: [_jsx(Field, { label: "Field", required: true, children: _jsx(ColumnSelector.Quantitative, { value: config.settings.field, onChange: (field) => onChangeConfig('field', field) }) }), _jsx(Field, { label: "Max Bins", children: _jsx(Input, { type: "number", min: MIN_BINS_COUNT, max: MAX_BINS_COUNT, value: config.settings.maxBins ?? DEFAULT_BINS_COUNT, className: "no-spinner", onChange: (e) => onChangeConfig('maxBins', parseInt(e.target.value, 10)), placeholder: String(DEFAULT_BINS_COUNT) }) })] }));
|
|
11
|
+
return (_jsxs("div", { className: "space-y-4", children: [_jsx(Field, { label: "Field", required: true, children: _jsxs("div", { className: "flex items-end gap-2", children: [_jsx(ColumnSelector.Quantitative, { className: "flex-1", value: config.settings.field, onChange: (field) => onChangeConfig('field', field) }), _jsx(ColorSelector, { items: DEFAULT_CHART_COLORS, value: config.settings.color ?? DEFAULT_CHART_FALLBACK_COLOR, onChange: (color) => onChangeConfig('color', color) })] }) }), _jsx(Field, { label: "Max Bins", children: _jsx(Input, { type: "number", min: MIN_BINS_COUNT, max: MAX_BINS_COUNT, value: config.settings.maxBins ?? DEFAULT_BINS_COUNT, className: "no-spinner", onChange: (e) => onChangeConfig('maxBins', parseInt(e.target.value, 10)), placeholder: String(DEFAULT_BINS_COUNT) }) })] }));
|
|
10
12
|
};
|
|
11
13
|
//# sourceMappingURL=HistogramSettings.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HistogramSettings.js","sourceRoot":"","sources":["../../../../src/charts/chart-types/histogram/HistogramSettings.tsx"],"names":[],"mappings":";AACA,OAAO,EAAC,KAAK,EAAC,MAAM,cAAc,CAAC;AACnC,OAAO,EAAC,KAAK,EAAC,MAAM,2BAA2B,CAAC;AAChD,OAAO,EAAC,cAAc,EAAC,MAAM,oCAAoC,CAAC;AAClE,OAAO,EAAC,6BAA6B,EAAC,MAAM,iDAAiD,CAAC;AAC9F,OAAO,EAAC,cAAc,EAAE,cAAc,EAAE,kBAAkB,EAAC,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"HistogramSettings.js","sourceRoot":"","sources":["../../../../src/charts/chart-types/histogram/HistogramSettings.tsx"],"names":[],"mappings":";AACA,OAAO,EAAC,KAAK,EAAC,MAAM,cAAc,CAAC;AACnC,OAAO,EAAC,KAAK,EAAC,MAAM,2BAA2B,CAAC;AAChD,OAAO,EAAC,cAAc,EAAC,MAAM,oCAAoC,CAAC;AAClE,OAAO,EAAC,aAAa,EAAC,MAAM,mCAAmC,CAAC;AAChE,OAAO,EAAC,6BAA6B,EAAC,MAAM,iDAAiD,CAAC;AAC9F,OAAO,EAAC,cAAc,EAAE,cAAc,EAAE,kBAAkB,EAAC,MAAM,UAAU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from '@sqlrooms/ui';\nimport {Field} from '../../../components/Field';\nimport {ColumnSelector} from '../../../components/ColumnSelector';\nimport {ColorSelector} from '../../../components/ColorSelector';\nimport {useMosaicChartSettingsContext} from '../../chart-settings/MosaicChartSettingsContext';\nimport {MIN_BINS_COUNT, MAX_BINS_COUNT, DEFAULT_BINS_COUNT} from './schema';\nimport {\n DEFAULT_CHART_COLORS,\n DEFAULT_CHART_FALLBACK_COLOR,\n} from '../../../constants/chart-colors';\n\nexport const HistogramSettingsComponent: FC = () => {\n const {onChangeConfig, config} = useMosaicChartSettingsContext('histogram');\n\n return (\n <div className=\"space-y-4\">\n <Field label=\"Field\" required>\n <div className=\"flex items-end gap-2\">\n <ColumnSelector.Quantitative\n className=\"flex-1\"\n value={config.settings.field}\n onChange={(field) => onChangeConfig('field', field)}\n />\n <ColorSelector\n items={DEFAULT_CHART_COLORS}\n value={config.settings.color ?? DEFAULT_CHART_FALLBACK_COLOR}\n onChange={(color) => onChangeConfig('color', color)}\n />\n </div>\n </Field>\n <Field label=\"Max Bins\">\n <Input\n type=\"number\"\n min={MIN_BINS_COUNT}\n max={MAX_BINS_COUNT}\n value={config.settings.maxBins ?? DEFAULT_BINS_COUNT}\n className=\"no-spinner\"\n onChange={(e) =>\n onChangeConfig('maxBins', parseInt(e.target.value, 10))\n }\n placeholder={String(DEFAULT_BINS_COUNT)}\n />\n </Field>\n </div>\n );\n};\n"]}
|
|
@@ -5,6 +5,7 @@ export declare const DEFAULT_BINS_COUNT = 20;
|
|
|
5
5
|
export declare const HistogramChartSettings: z.ZodObject<{
|
|
6
6
|
field: z.ZodOptional<z.ZodString>;
|
|
7
7
|
maxBins: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
8
|
+
color: z.ZodOptional<z.ZodString>;
|
|
8
9
|
}, z.core.$strip>;
|
|
9
10
|
export type HistogramChartSettings = z.infer<typeof HistogramChartSettings>;
|
|
10
11
|
export declare const HistogramChartConfig: z.ZodObject<{
|
|
@@ -12,6 +13,7 @@ export declare const HistogramChartConfig: z.ZodObject<{
|
|
|
12
13
|
settings: z.ZodObject<{
|
|
13
14
|
field: z.ZodOptional<z.ZodString>;
|
|
14
15
|
maxBins: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
16
|
+
color: z.ZodOptional<z.ZodString>;
|
|
15
17
|
}, z.core.$strip>;
|
|
16
18
|
settingsOpen: z.ZodOptional<z.ZodBoolean>;
|
|
17
19
|
dataPolicy: z.ZodOptional<z.ZodObject<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/charts/chart-types/histogram/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAGtB,eAAO,MAAM,cAAc,IAAI,CAAC;AAChC,eAAO,MAAM,cAAc,OAAO,CAAC;AACnC,eAAO,MAAM,kBAAkB,KAAK,CAAC;AAErC,eAAO,MAAM,sBAAsB
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/charts/chart-types/histogram/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAGtB,eAAO,MAAM,cAAc,IAAI,CAAC;AAChC,eAAO,MAAM,cAAc,OAAO,CAAC;AACnC,eAAO,MAAM,kBAAkB,KAAK,CAAC;AAErC,eAAO,MAAM,sBAAsB;;;;iBAgBjC,CAAC;AAEH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAE5E,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;iBAK/B,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
|
|
@@ -16,6 +16,7 @@ export const HistogramChartSettings = z.object({
|
|
|
16
16
|
.default(DEFAULT_BINS_COUNT)
|
|
17
17
|
.optional()
|
|
18
18
|
.describe(`Maximum number of bins for the histogram (default: ${DEFAULT_BINS_COUNT})`),
|
|
19
|
+
color: z.string().optional().describe('Optional color for histogram bars'),
|
|
19
20
|
});
|
|
20
21
|
export const HistogramChartConfig = z.object({
|
|
21
22
|
chartType: z.literal('histogram'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../src/charts/chart-types/histogram/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AACtB,OAAO,EAAC,6BAA6B,EAAC,MAAM,uBAAuB,CAAC;AAEpE,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC;AAChC,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,CAAC;AACnC,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAErC,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,KAAK,EAAE,CAAC;SACL,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,qDAAqD,CAAC;IAClE,OAAO,EAAE,CAAC;SACP,MAAM,EAAE;SACR,GAAG,EAAE;SACL,GAAG,CAAC,cAAc,CAAC;SACnB,GAAG,CAAC,cAAc,CAAC;SACnB,OAAO,CAAC,kBAAkB,CAAC;SAC3B,QAAQ,EAAE;SACV,QAAQ,CACP,sDAAsD,kBAAkB,GAAG,CAC5E;
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../src/charts/chart-types/histogram/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AACtB,OAAO,EAAC,6BAA6B,EAAC,MAAM,uBAAuB,CAAC;AAEpE,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC;AAChC,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,CAAC;AACnC,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAErC,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,KAAK,EAAE,CAAC;SACL,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,qDAAqD,CAAC;IAClE,OAAO,EAAE,CAAC;SACP,MAAM,EAAE;SACR,GAAG,EAAE;SACL,GAAG,CAAC,cAAc,CAAC;SACnB,GAAG,CAAC,cAAc,CAAC;SACnB,OAAO,CAAC,kBAAkB,CAAC;SAC3B,QAAQ,EAAE;SACV,QAAQ,CACP,sDAAsD,kBAAkB,GAAG,CAC5E;IACH,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,mCAAmC,CAAC;CAC3E,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC;IACjC,QAAQ,EAAE,sBAAsB;IAChC,YAAY,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IACpC,UAAU,EAAE,6BAA6B,CAAC,QAAQ,EAAE;CACrD,CAAC,CAAC","sourcesContent":["import {z} from 'zod';\nimport {ChartDataPolicyOverrideConfig} from '../data-policy-schema';\n\nexport const MIN_BINS_COUNT = 1;\nexport const MAX_BINS_COUNT = 1000;\nexport const DEFAULT_BINS_COUNT = 20;\n\nexport const HistogramChartSettings = z.object({\n field: z\n .string()\n .optional()\n .describe('Numeric column to create histogram distribution for'),\n maxBins: z\n .number()\n .int()\n .min(MIN_BINS_COUNT)\n .max(MAX_BINS_COUNT)\n .default(DEFAULT_BINS_COUNT)\n .optional()\n .describe(\n `Maximum number of bins for the histogram (default: ${DEFAULT_BINS_COUNT})`,\n ),\n color: z.string().optional().describe('Optional color for histogram bars'),\n});\n\nexport type HistogramChartSettings = z.infer<typeof HistogramChartSettings>;\n\nexport const HistogramChartConfig = z.object({\n chartType: z.literal('histogram'),\n settings: HistogramChartSettings,\n settingsOpen: z.boolean().optional(),\n dataPolicy: ChartDataPolicyOverrideConfig.optional(),\n});\n\nexport type HistogramChartConfig = z.infer<typeof HistogramChartConfig>;\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Spec } from '@uwdata/mosaic-spec';
|
|
2
2
|
import { HistogramChartSettings } from './schema';
|
|
3
|
-
|
|
3
|
+
import { CreateSpecOptions } from '../base-types';
|
|
4
|
+
export declare function createHistogramSpec(options: CreateSpecOptions<HistogramChartSettings>): Spec;
|
|
4
5
|
//# sourceMappingURL=spec.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spec.d.ts","sourceRoot":"","sources":["../../../../src/charts/chart-types/histogram/spec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAC,sBAAsB,EAAqB,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"spec.d.ts","sourceRoot":"","sources":["../../../../src/charts/chart-types/histogram/spec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAC,sBAAsB,EAAqB,MAAM,UAAU,CAAC;AACpE,OAAO,EAAC,iBAAiB,EAAyB,MAAM,eAAe,CAAC;AAaxE,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,iBAAiB,CAAC,sBAAsB,CAAC,GACjD,IAAI,CAsCN"}
|
|
@@ -1,37 +1,60 @@
|
|
|
1
1
|
import { DEFAULT_BINS_COUNT } from './schema';
|
|
2
|
-
import {
|
|
2
|
+
import { getChartTableReference } from '../base-types';
|
|
3
|
+
import { InvalidColumnTypeError, MissingColumnsError, RequiredFieldsError, } from '../errors';
|
|
4
|
+
import { isQuantitativeType } from '../../../column-types-utils';
|
|
5
|
+
import { DEFAULT_CHART_FALLBACK_COLOR } from '../../../constants/chart-colors';
|
|
3
6
|
const BG_COLOR = 'var(--color-chart-overlay)';
|
|
4
|
-
const
|
|
5
|
-
export function createHistogramSpec(
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
const DEFAULT_FG_COLOR = DEFAULT_CHART_FALLBACK_COLOR;
|
|
8
|
+
export function createHistogramSpec(options) {
|
|
9
|
+
const { dataTable, selectionName, settings } = options;
|
|
10
|
+
const { fieldColumn, maxBins } = validateHistogramSettings(options);
|
|
11
|
+
const fgColor = settings.color ?? DEFAULT_FG_COLOR;
|
|
12
|
+
const tableReference = getChartTableReference(dataTable);
|
|
13
|
+
const plot = [
|
|
14
|
+
{
|
|
15
|
+
mark: 'rectY',
|
|
16
|
+
data: { from: tableReference },
|
|
17
|
+
x: { bin: fieldColumn.name, steps: maxBins },
|
|
18
|
+
y: { count: null },
|
|
19
|
+
fill: BG_COLOR,
|
|
20
|
+
inset: 0.5,
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
mark: 'rectY',
|
|
24
|
+
data: { from: tableReference, filterBy: '$brush' },
|
|
25
|
+
x: { bin: fieldColumn.name, steps: maxBins },
|
|
26
|
+
y: { count: null },
|
|
27
|
+
fill: fgColor,
|
|
28
|
+
inset: 0.5,
|
|
29
|
+
},
|
|
30
|
+
];
|
|
31
|
+
if (selectionName) {
|
|
32
|
+
plot.push({ select: 'intervalX', as: '$brush' });
|
|
8
33
|
}
|
|
9
34
|
return {
|
|
10
|
-
plot
|
|
11
|
-
|
|
12
|
-
mark: 'rectY',
|
|
13
|
-
data: { from: tableName },
|
|
14
|
-
x: { bin: field, steps: maxBins },
|
|
15
|
-
y: { count: null },
|
|
16
|
-
fill: BG_COLOR,
|
|
17
|
-
inset: 0.5,
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
mark: 'rectY',
|
|
21
|
-
data: { from: tableName, filterBy: '$brush' },
|
|
22
|
-
x: { bin: field, steps: maxBins },
|
|
23
|
-
y: { count: null },
|
|
24
|
-
fill: FG_COLOR,
|
|
25
|
-
inset: 0.5,
|
|
26
|
-
},
|
|
27
|
-
{ select: 'intervalX', as: '$brush' },
|
|
28
|
-
],
|
|
29
|
-
xLabel: field,
|
|
35
|
+
plot,
|
|
36
|
+
xLabel: fieldColumn.name,
|
|
30
37
|
yLabel: 'Count',
|
|
31
|
-
height: 200,
|
|
32
|
-
width: 380,
|
|
33
38
|
margins: { left: 50, right: 20, top: 20, bottom: 50 },
|
|
34
39
|
params: { brush: { select: 'crossfilter' } },
|
|
35
40
|
};
|
|
36
41
|
}
|
|
42
|
+
function validateHistogramSettings({ dataTable, settings: { field, maxBins = DEFAULT_BINS_COUNT }, }) {
|
|
43
|
+
// Basic validation for required fields
|
|
44
|
+
if (!field) {
|
|
45
|
+
throw new RequiredFieldsError('Field');
|
|
46
|
+
}
|
|
47
|
+
// Validate field existence and type
|
|
48
|
+
const fieldColumn = dataTable.columns.find((col) => col.name === field);
|
|
49
|
+
if (!fieldColumn) {
|
|
50
|
+
throw new MissingColumnsError(field);
|
|
51
|
+
}
|
|
52
|
+
if (!isQuantitativeType(fieldColumn.type)) {
|
|
53
|
+
throw new InvalidColumnTypeError(fieldColumn.name, 'quantitative');
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
fieldColumn,
|
|
57
|
+
maxBins,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
37
60
|
//# sourceMappingURL=spec.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spec.js","sourceRoot":"","sources":["../../../../src/charts/chart-types/histogram/spec.ts"],"names":[],"mappings":"AACA,OAAO,EAAyB,kBAAkB,EAAC,MAAM,UAAU,CAAC;AACpE,OAAO,
|
|
1
|
+
{"version":3,"file":"spec.js","sourceRoot":"","sources":["../../../../src/charts/chart-types/histogram/spec.ts"],"names":[],"mappings":"AACA,OAAO,EAAyB,kBAAkB,EAAC,MAAM,UAAU,CAAC;AACpE,OAAO,EAAoB,sBA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B,IAAI,CAAC,IAAI,CAAC,EAAC,MAAM,EAAE,WAAW,EAAE,EAAE,EAAE,QAAQ,EAAC,CAAC,CAAC;IACjD,CAAC;IAED,OAAO;QACL,IAAI;QACJ,MAAM,EAAE,WAAW,CAAC,IAAI;QACxB,MAAM,EAAE,OAAO;QAEf,OAAO,EAAE,EAAC,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAC;QACnD,MAAM,EAAE,EAAC,KAAK,EAAE,EAAC,MAAM,EAAE,aAAa,EAAC,EAAC;KACjC,CAAC;AACZ,CAAC;AAOD,SAAS,yBAAyB,CAAC,EACjC,SAAS,EACT,QAAQ,EAAE,EAAC,KAAK,EAAE,OAAO,GAAG,kBAAkB,EAAC,GACL;IAC1C,uCAAuC;IACvC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,mBAAmB,CAAC,OAAO,CAAC,CAAC;IACzC,CAAC;IAED,oCAAoC;IACpC,MAAM,WAAW,GAAG,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC;IAExE,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,MAAM,IAAI,mBAAmB,CAAC,KAAK,CAAC,CAAC;IACvC,CAAC;IAED,IAAI,CAAC,kBAAkB,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC;QAC1C,MAAM,IAAI,sBAAsB,CAAC,WAAW,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;IACrE,CAAC;IAED,OAAO;QACL,WAAW;QACX,OAAO;KACR,CAAC;AACJ,CAAC","sourcesContent":["import type {Spec} from '@uwdata/mosaic-spec';\nimport {HistogramChartSettings, DEFAULT_BINS_COUNT} from './schema';\nimport {CreateSpecOptions, getChartTableReference} from '../base-types';\nimport {\n InvalidColumnTypeError,\n MissingColumnsError,\n RequiredFieldsError,\n} from '../errors';\nimport {isQuantitativeType} from '../../../column-types-utils';\nimport {TableColumn} from '@sqlrooms/duckdb';\nimport {DEFAULT_CHART_FALLBACK_COLOR} from '../../../constants/chart-colors';\n\nconst BG_COLOR = 'var(--color-chart-overlay)';\nconst DEFAULT_FG_COLOR = DEFAULT_CHART_FALLBACK_COLOR;\n\nexport function createHistogramSpec(\n options: CreateSpecOptions<HistogramChartSettings>,\n): Spec {\n const {dataTable, selectionName, settings} = options;\n\n const {fieldColumn, maxBins} = validateHistogramSettings(options);\n const fgColor = settings.color ?? DEFAULT_FG_COLOR;\n const tableReference = getChartTableReference(dataTable);\n\n const plot: unknown[] = [\n {\n mark: 'rectY',\n data: {from: tableReference},\n x: {bin: fieldColumn.name, steps: maxBins},\n y: {count: null},\n fill: BG_COLOR,\n inset: 0.5,\n },\n {\n mark: 'rectY',\n data: {from: tableReference, filterBy: '$brush'},\n x: {bin: fieldColumn.name, steps: maxBins},\n y: {count: null},\n fill: fgColor,\n inset: 0.5,\n },\n ];\n\n if (selectionName) {\n plot.push({select: 'intervalX', as: '$brush'});\n }\n\n return {\n plot,\n xLabel: fieldColumn.name,\n yLabel: 'Count',\n\n margins: {left: 50, right: 20, top: 20, bottom: 50},\n params: {brush: {select: 'crossfilter'}},\n } as Spec;\n}\n\ntype ValidatedHistogramSettings = {\n fieldColumn: TableColumn;\n maxBins: number;\n};\n\nfunction validateHistogramSettings({\n dataTable,\n settings: {field, maxBins = DEFAULT_BINS_COUNT},\n}: CreateSpecOptions<HistogramChartSettings>): ValidatedHistogramSettings {\n // Basic validation for required fields\n if (!field) {\n throw new RequiredFieldsError('Field');\n }\n\n // Validate field existence and type\n const fieldColumn = dataTable.columns.find((col) => col.name === field);\n\n if (!fieldColumn) {\n throw new MissingColumnsError(field);\n }\n\n if (!isQuantitativeType(fieldColumn.type)) {\n throw new InvalidColumnTypeError(fieldColumn.name, 'quantitative');\n }\n\n return {\n fieldColumn,\n maxBins,\n };\n}\n"]}
|
|
@@ -9,6 +9,7 @@ export declare const HistogramToolParameters: z.ZodObject<{
|
|
|
9
9
|
settings: z.ZodObject<{
|
|
10
10
|
field: z.ZodNonOptional<z.ZodOptional<z.ZodString>>;
|
|
11
11
|
maxBins: z.ZodNonOptional<z.ZodOptional<z.ZodDefault<z.ZodNumber>>>;
|
|
12
|
+
color: z.ZodNonOptional<z.ZodOptional<z.ZodString>>;
|
|
12
13
|
}, z.core.$strip>;
|
|
13
14
|
}, z.core.$strip>;
|
|
14
15
|
export type HistogramToolParams = z.infer<typeof HistogramToolParameters>;
|
|
@@ -18,6 +19,7 @@ export declare function createHistogramAiTool(deps: DashboardToolDeps): import("
|
|
|
18
19
|
settings: {
|
|
19
20
|
field: string;
|
|
20
21
|
maxBins: number;
|
|
22
|
+
color: string;
|
|
21
23
|
};
|
|
22
24
|
artifactId?: string | undefined;
|
|
23
25
|
tableName?: string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../../../../src/charts/chart-types/histogram/tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAQtB,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAKrD,eAAO,MAAM,uBAAuB
|
|
1
|
+
{"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../../../../src/charts/chart-types/histogram/tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAQtB,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAKrD,eAAO,MAAM,uBAAuB;;;;;;;;;;;iBAElC,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAE1E,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;GAqE5D"}
|
|
@@ -23,7 +23,7 @@ To UPDATE an existing histogram: provide the panelId parameter. Otherwise create
|
|
|
23
23
|
Optional: maxBins (${MIN_BINS_COUNT}-${MAX_BINS_COUNT}, default ${DEFAULT_BINS_COUNT}) controls the number of bins/bars in the histogram. Use fewer bins for coarse overview, more bins for detailed distribution.
|
|
24
24
|
|
|
25
25
|
CRITICAL: Only for quantitative continuous data to see distribution shape, outliers, skewness.
|
|
26
|
-
Do NOT use for: categorical data (use count-plot), relationships between columns (use
|
|
26
|
+
Do NOT use for: categorical data (use count-plot), relationships between columns (use scatter-plot), time series trends (use line-chart).`,
|
|
27
27
|
inputSchema: HistogramToolParameters,
|
|
28
28
|
execute: async (params, context) => {
|
|
29
29
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool.js","sourceRoot":"","sources":["../../../../src/charts/chart-types/histogram/tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,IAAI,CAAC;AAExB,OAAO,EACL,sBAAsB,EACtB,cAAc,EACd,cAAc,EACd,kBAAkB,GACnB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAC,uBAAuB,EAAC,MAAM,0BAA0B,CAAC;AAEjE,OAAO,EAAC,oBAAoB,EAAC,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAC,yBAAyB,EAAC,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAC,wBAAwB,EAAC,MAAM,0BAA0B,CAAC;AAElE,MAAM,CAAC,MAAM,uBAAuB,GAAG,uBAAuB,CAAC,MAAM,CAAC;IACpE,QAAQ,EAAE,sBAAsB,CAAC,QAAQ,EAAE;CAC5C,CAAC,CAAC;AAIH,MAAM,UAAU,qBAAqB,CAAC,IAAuB;IAC3D,OAAO,IAAI,CAAC;QACV,WAAW,EAAE;;;;;8DAK6C,yBAAyB,CAAC,IAAI,CAAC,IAAI,CAAC;;;;;;qBAM7E,cAAc,IAAI,cAAc,aAAa,kBAAkB;;;0IAGs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CAAC;QACH,CAAC;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {tool} from 'ai';\nimport {z} from 'zod';\nimport {\n HistogramChartSettings,\n MIN_BINS_COUNT,\n MAX_BINS_COUNT,\n DEFAULT_BINS_COUNT,\n} from './schema';\nimport {BaseChartToolParameters} from '../../../ai/tool-schemas';\nimport type {DashboardToolDeps} from '../base-types';\nimport {validateColumnExists} from '../../../ai/tool-validation';\nimport {QUANTITATIVE_COLUMN_TYPES} from '../../../column-types-utils';\nimport {createOrUpdateChartPanel} from '../../../ai/tool-helpers';\n\nexport const HistogramToolParameters = BaseChartToolParameters.extend({\n settings: HistogramChartSettings.required(),\n});\n\nexport type HistogramToolParams = z.infer<typeof HistogramToolParameters>;\n\nexport function createHistogramAiTool(deps: DashboardToolDeps) {\n return tool({\n description: `Histogram: shows distribution of numeric values by automatically grouping data into bins/ranges.\n\nUse when: user asks about \"distribution of [numeric column]\", \"spread of\", \"range of\", \"how values are distributed\", \"show histogram\".\nExample queries: \"distribution of population density\", \"show elevation distribution\", \"histogram of parcel areas\", \"how are building heights spread\", \"temperature range distribution\".\n\nRequired: field must be quantitative not text/categorical: (${QUANTITATIVE_COLUMN_TYPES.join(', ')}).\n\nNOTE: Histograms automatically bin data into ranges and aggregate counts, so they handle large datasets efficiently (no data point limit).\n\nTo UPDATE an existing histogram: provide the panelId parameter. Otherwise creates new panel.\n\nOptional: maxBins (${MIN_BINS_COUNT}-${MAX_BINS_COUNT}, default ${DEFAULT_BINS_COUNT}) controls the number of bins/bars in the histogram. Use fewer bins for coarse overview, more bins for detailed distribution.\n\nCRITICAL: Only for quantitative continuous data to see distribution shape, outliers, skewness.\nDo NOT use for: categorical data (use count-plot), relationships between columns (use
|
|
1
|
+
{"version":3,"file":"tool.js","sourceRoot":"","sources":["../../../../src/charts/chart-types/histogram/tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,IAAI,CAAC;AAExB,OAAO,EACL,sBAAsB,EAC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EAAE;oBAC9C,MAAM,EAAE;wBACN,SAAS,EAAE,WAAW;wBACtB,QAAQ,EAAE,MAAM,CAAC,QAAQ;qBAC1B;iBACF,CAAC,CAAC;gBAEH,OAAO;oBACL,SAAS,EAAE;wBACT,OAAO,EAAE,IAAI;wBACb,OAAO,EAAE,MAAM,CAAC,OAAO;4BACrB,CAAC,CAAC,sBAAsB,MAAM,CAAC,KAAK,IAAI;4BACxC,CAAC,CAAC,sBAAsB,MAAM,CAAC,KAAK,IAAI;wBAC1C,IAAI,EAAE,MAAM;qBACb;iBACF,CAAC;YACJ,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO;oBACL,SAAS,EAAE;wBACT,OAAO,EAAE,KAAK;wBACd,YAAY,EACV,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;qBACzD;iBACF,CAAC;YACJ,CAAC;QACH,CAAC;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {tool} from 'ai';\nimport {z} from 'zod';\nimport {\n HistogramChartSettings,\n MIN_BINS_COUNT,\n MAX_BINS_COUNT,\n DEFAULT_BINS_COUNT,\n} from './schema';\nimport {BaseChartToolParameters} from '../../../ai/tool-schemas';\nimport type {DashboardToolDeps} from '../base-types';\nimport {validateColumnExists} from '../../../ai/tool-validation';\nimport {QUANTITATIVE_COLUMN_TYPES} from '../../../column-types-utils';\nimport {createOrUpdateChartPanel} from '../../../ai/tool-helpers';\n\nexport const HistogramToolParameters = BaseChartToolParameters.extend({\n settings: HistogramChartSettings.required(),\n});\n\nexport type HistogramToolParams = z.infer<typeof HistogramToolParameters>;\n\nexport function createHistogramAiTool(deps: DashboardToolDeps) {\n return tool({\n description: `Histogram: shows distribution of numeric values by automatically grouping data into bins/ranges.\n\nUse when: user asks about \"distribution of [numeric column]\", \"spread of\", \"range of\", \"how values are distributed\", \"show histogram\".\nExample queries: \"distribution of population density\", \"show elevation distribution\", \"histogram of parcel areas\", \"how are building heights spread\", \"temperature range distribution\".\n\nRequired: field must be quantitative not text/categorical: (${QUANTITATIVE_COLUMN_TYPES.join(', ')}).\n\nNOTE: Histograms automatically bin data into ranges and aggregate counts, so they handle large datasets efficiently (no data point limit).\n\nTo UPDATE an existing histogram: provide the panelId parameter. Otherwise creates new panel.\n\nOptional: maxBins (${MIN_BINS_COUNT}-${MAX_BINS_COUNT}, default ${DEFAULT_BINS_COUNT}) controls the number of bins/bars in the histogram. Use fewer bins for coarse overview, more bins for detailed distribution.\n\nCRITICAL: Only for quantitative continuous data to see distribution shape, outliers, skewness.\nDo NOT use for: categorical data (use count-plot), relationships between columns (use scatter-plot), time series trends (use line-chart).`,\n inputSchema: HistogramToolParameters,\n execute: async (params, context) => {\n try {\n const artifactId = deps.resolveArtifact(\n params.artifactId,\n params.createArtifactIfMissing,\n context,\n );\n const {tableName, columns} = deps.resolveTable(\n artifactId,\n params.tableName,\n );\n\n // Validate settings\n validateColumnExists(\n params.settings.field,\n QUANTITATIVE_COLUMN_TYPES,\n columns,\n 'field',\n );\n\n const result = createOrUpdateChartPanel(deps, {\n panelId: params.panelId,\n dashboardId: artifactId,\n tableName,\n title: `Histogram of ${params.settings.field}`,\n config: {\n chartType: 'histogram',\n settings: params.settings,\n },\n });\n\n return {\n llmResult: {\n success: true,\n details: params.panelId\n ? `Updated histogram \"${result.title}\".`\n : `Created histogram \"${result.title}\".`,\n data: result,\n },\n };\n } catch (error) {\n return {\n llmResult: {\n success: false,\n errorMessage:\n error instanceof Error ? error.message : String(error),\n },\n };\n }\n },\n });\n}\n"]}
|
|
@@ -7,21 +7,21 @@ export * from './line-chart/schema';
|
|
|
7
7
|
export * from './count-plot/schema';
|
|
8
8
|
export * from './heatmap/schema';
|
|
9
9
|
export * from './box-plot/schema';
|
|
10
|
-
export * from './
|
|
10
|
+
export * from './scatter-plot/schema';
|
|
11
11
|
export * from './custom-spec/schema';
|
|
12
12
|
export { HistogramSettingsComponent } from './histogram/HistogramSettings';
|
|
13
13
|
export { LineChartSettingsComponent } from './line-chart/LineChartSettings';
|
|
14
14
|
export { CountPlotSettingsComponent } from './count-plot/CountPlotSettings';
|
|
15
15
|
export { HeatmapSettingsComponent } from './heatmap/HeatmapSettings';
|
|
16
16
|
export { BoxPlotSettingsComponent } from './box-plot/BoxPlotSettings';
|
|
17
|
-
export {
|
|
17
|
+
export { ScatterPlotSettingsComponent } from './scatter-plot/ScatterPlotSettings';
|
|
18
18
|
export { CustomSpecSettingsComponent } from './custom-spec/CustomSpecSettings';
|
|
19
19
|
export * from './histogram/definition';
|
|
20
20
|
export * from './line-chart/definition';
|
|
21
21
|
export * from './count-plot/definition';
|
|
22
22
|
export * from './heatmap/definition';
|
|
23
23
|
export * from './box-plot/definition';
|
|
24
|
-
export * from './
|
|
24
|
+
export * from './scatter-plot/definition';
|
|
25
25
|
export * from './custom-spec/definition';
|
|
26
26
|
export * from '../../ai/tool-types';
|
|
27
27
|
export * from '../../ai/tool-schemas';
|
|
@@ -31,7 +31,7 @@ export * from './histogram/tool';
|
|
|
31
31
|
export * from './line-chart/tool';
|
|
32
32
|
export * from './count-plot/tool';
|
|
33
33
|
export * from './heatmap/tool';
|
|
34
|
-
export * from './
|
|
34
|
+
export * from './scatter-plot/tool';
|
|
35
35
|
export * from './box-plot/tool';
|
|
36
36
|
export * from '../../ai/data-table-explorer-tool';
|
|
37
37
|
export * from '../../ai/list-panels-tool';
|
|
@@ -14,7 +14,7 @@ export * from './line-chart/schema';
|
|
|
14
14
|
export * from './count-plot/schema';
|
|
15
15
|
export * from './heatmap/schema';
|
|
16
16
|
export * from './box-plot/schema';
|
|
17
|
-
export * from './
|
|
17
|
+
export * from './scatter-plot/schema';
|
|
18
18
|
export * from './custom-spec/schema';
|
|
19
19
|
// Re-export Settings components
|
|
20
20
|
export { HistogramSettingsComponent } from './histogram/HistogramSettings';
|
|
@@ -22,7 +22,7 @@ export { LineChartSettingsComponent } from './line-chart/LineChartSettings';
|
|
|
22
22
|
export { CountPlotSettingsComponent } from './count-plot/CountPlotSettings';
|
|
23
23
|
export { HeatmapSettingsComponent } from './heatmap/HeatmapSettings';
|
|
24
24
|
export { BoxPlotSettingsComponent } from './box-plot/BoxPlotSettings';
|
|
25
|
-
export {
|
|
25
|
+
export { ScatterPlotSettingsComponent } from './scatter-plot/ScatterPlotSettings';
|
|
26
26
|
export { CustomSpecSettingsComponent } from './custom-spec/CustomSpecSettings';
|
|
27
27
|
// Re-export definitions
|
|
28
28
|
export * from './histogram/definition';
|
|
@@ -30,7 +30,7 @@ export * from './line-chart/definition';
|
|
|
30
30
|
export * from './count-plot/definition';
|
|
31
31
|
export * from './heatmap/definition';
|
|
32
32
|
export * from './box-plot/definition';
|
|
33
|
-
export * from './
|
|
33
|
+
export * from './scatter-plot/definition';
|
|
34
34
|
export * from './custom-spec/definition';
|
|
35
35
|
// Re-export tool types, schemas, validation, helpers, and AI tool creators
|
|
36
36
|
export * from '../../ai/tool-types';
|
|
@@ -41,7 +41,7 @@ export * from './histogram/tool';
|
|
|
41
41
|
export * from './line-chart/tool';
|
|
42
42
|
export * from './count-plot/tool';
|
|
43
43
|
export * from './heatmap/tool';
|
|
44
|
-
export * from './
|
|
44
|
+
export * from './scatter-plot/tool';
|
|
45
45
|
export * from './box-plot/tool';
|
|
46
46
|
export * from '../../ai/data-table-explorer-tool';
|
|
47
47
|
export * from '../../ai/list-panels-tool';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/charts/chart-types/index.ts"],"names":[],"mappings":"AAAA,uBAAuB;AACvB,cAAc,cAAc,CAAC;AAE7B,gDAAgD;AAChD,cAAc,UAAU,CAAC;AAEzB,2EAA2E;AAC3E,uEAAuE;AACvE,qFAAqF;AACrF,6BAA6B;AAC7B,OAAO,EAAC,WAAW,EAAqC,MAAM,gBAAgB,CAAC;AAC/E,cAAc,sBAAsB,CAAC;AAErC,oBAAoB;AACpB,cAAc,oBAAo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2B,CAAC;AAClE,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAC","sourcesContent":["// Re-export base types\nexport * from './base-types';\n\n// Re-export error classes for chart definitions\nexport * from './errors';\n\n// CRITICAL: Export ChartConfig FIRST, before importing Settings components\n// Export ChartConfig from separate file to avoid circular dependencies\n// (chart-types/index imports Settings components, which import ChartSettingsContext,\n// which imports ChartConfig)\nexport {ChartConfig, type ChartSettings, type ChartType} from './chart-config';\nexport * from './data-policy-schema';\n\n// Re-export schemas\nexport * from './histogram/schema';\nexport * from './line-chart/schema';\nexport * from './count-plot/schema';\nexport * from './heatmap/schema';\nexport * from './box-plot/schema';\nexport * from './
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/charts/chart-types/index.ts"],"names":[],"mappings":"AAAA,uBAAuB;AACvB,cAAc,cAAc,CAAC;AAE7B,gDAAgD;AAChD,cAAc,UAAU,CAAC;AAEzB,2EAA2E;AAC3E,uEAAuE;AACvE,qFAAqF;AACrF,6BAA6B;AAC7B,OAAO,EAAC,WAAW,EAAqC,MAAM,gBAAgB,CAAC;AAC/E,cAAc,sBAAsB,CAAC;AAErC,oBAAoB;AACpB,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AAErC,gCAAgC;AAChC,OAAO,EAAC,0BAA0B,EAAC,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAC,0BAA0B,EAAC,MAAM,gCAAgC,CAAC;AAC1E,OAAO,EAAC,0BAA0B,EAAC,MAAM,gCAAgC,CAAC;AAC1E,OAAO,EAAC,wBAAwB,EAAC,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAC,wBAAwB,EAAC,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAC,4BAA4B,EAAC,MAAM,oCAAoC,CAAC;AAChF,OAAO,EAAC,2BAA2B,EAAC,MAAM,kCAAkC,CAAC;AAE7E,wBAAwB;AACxB,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AAEzC,2EAA2E;AAC3E,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mCAAmC,CAAC;AAClD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAE3C,iCAAiC;AACjC,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAC,uBAAuB,EAAC,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAC","sourcesContent":["// Re-export base types\nexport * from './base-types';\n\n// Re-export error classes for chart definitions\nexport * from './errors';\n\n// CRITICAL: Export ChartConfig FIRST, before importing Settings components\n// Export ChartConfig from separate file to avoid circular dependencies\n// (chart-types/index imports Settings components, which import ChartSettingsContext,\n// which imports ChartConfig)\nexport {ChartConfig, type ChartSettings, type ChartType} from './chart-config';\nexport * from './data-policy-schema';\n\n// Re-export schemas\nexport * from './histogram/schema';\nexport * from './line-chart/schema';\nexport * from './count-plot/schema';\nexport * from './heatmap/schema';\nexport * from './box-plot/schema';\nexport * from './scatter-plot/schema';\nexport * from './custom-spec/schema';\n\n// Re-export Settings components\nexport {HistogramSettingsComponent} from './histogram/HistogramSettings';\nexport {LineChartSettingsComponent} from './line-chart/LineChartSettings';\nexport {CountPlotSettingsComponent} from './count-plot/CountPlotSettings';\nexport {HeatmapSettingsComponent} from './heatmap/HeatmapSettings';\nexport {BoxPlotSettingsComponent} from './box-plot/BoxPlotSettings';\nexport {ScatterPlotSettingsComponent} from './scatter-plot/ScatterPlotSettings';\nexport {CustomSpecSettingsComponent} from './custom-spec/CustomSpecSettings';\n\n// Re-export definitions\nexport * from './histogram/definition';\nexport * from './line-chart/definition';\nexport * from './count-plot/definition';\nexport * from './heatmap/definition';\nexport * from './box-plot/definition';\nexport * from './scatter-plot/definition';\nexport * from './custom-spec/definition';\n\n// Re-export tool types, schemas, validation, helpers, and AI tool creators\nexport * from '../../ai/tool-types';\nexport * from '../../ai/tool-schemas';\nexport * from '../../ai/tool-validation';\nexport * from '../../ai/tool-helpers';\nexport * from './histogram/tool';\nexport * from './line-chart/tool';\nexport * from './count-plot/tool';\nexport * from './heatmap/tool';\nexport * from './scatter-plot/tool';\nexport * from './box-plot/tool';\nexport * from '../../ai/data-table-explorer-tool';\nexport * from '../../ai/list-panels-tool';\nexport * from '../../ai/remove-panel-tool';\n\n// Re-export chart type utilities\nexport {mosaicChartTypes} from './mosaicChartTypes';\nexport {createDefaultChartTypes} from './createDefaultChartTypes';\nexport {createChartTools} from './createChartTools';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LineChartSettings.d.ts","sourceRoot":"","sources":["../../../../src/charts/chart-types/line-chart/LineChartSettings.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAE,EAAC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"LineChartSettings.d.ts","sourceRoot":"","sources":["../../../../src/charts/chart-types/line-chart/LineChartSettings.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAE,EAAC,MAAM,OAAO,CAAC;AAO9B;;;GAGG;AACH,eAAO,MAAM,0BAA0B,EAAE,EA2BxC,CAAC"}
|
|
@@ -1,24 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Field } from '../../../components/Field';
|
|
3
|
-
import {
|
|
4
|
-
import { TemporalGranularitySelector } from '../../../components/TemporalGranularitySelector';
|
|
3
|
+
import { Switch } from '@sqlrooms/ui';
|
|
5
4
|
import { useMosaicChartSettingsContext } from '../../chart-settings/MosaicChartSettingsContext';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { useColumnsContext } from '../../../components/ColumnsContext';
|
|
5
|
+
import { LineChartYFieldsSelector } from './LineChartYFieldsSelector';
|
|
6
|
+
import { LineChartXFieldSelector } from './LineChartXFieldSelector';
|
|
9
7
|
/**
|
|
10
8
|
* Explicit settings component for line chart.
|
|
11
9
|
* Composes primitive and compound components for full control over the UI.
|
|
12
10
|
*/
|
|
13
11
|
export const LineChartSettingsComponent = () => {
|
|
14
12
|
const { onChangeConfig, config } = useMosaicChartSettingsContext('line-chart');
|
|
15
|
-
|
|
16
|
-
const xField = columns.find((c) => c.name === config.settings.x);
|
|
17
|
-
const isXFieldTemporal = xField && isTemporalType(xField.type);
|
|
18
|
-
return (_jsxs("div", { className: "space-y-4", children: [_jsx(Field, { label: "X Axis", required: true, children: _jsxs("div", { className: "grid items-end gap-2", style: {
|
|
19
|
-
gridTemplateColumns: isXFieldTemporal
|
|
20
|
-
? 'minmax(120px, 1fr) 100px'
|
|
21
|
-
: '1fr',
|
|
22
|
-
}, children: [_jsx(ColumnSelector.Quantitative, { value: config.settings.x, onChange: (x) => onChangeConfig('x', x) }), isXFieldTemporal && (_jsx(TemporalGranularitySelector, { value: config.settings.xInterval, onChange: (xInterval) => onChangeConfig('xInterval', xInterval), xFieldType: xField.type }))] }) }), _jsx(Field, { label: "Y Axis", required: true, children: _jsx(MultiFieldSelector.Numeric, { value: config.settings.yFields ?? [], onChange: (yFields) => onChangeConfig('yFields', yFields), showAggregation: Boolean(config.settings.xInterval) }) })] }));
|
|
13
|
+
return (_jsxs("div", { className: "space-y-4", children: [_jsx(Field, { label: "X Axis", required: true, children: _jsx(LineChartXFieldSelector, {}) }), _jsx(Field, { label: "Y Axis", required: true, children: _jsx(LineChartYFieldsSelector, {}) }), _jsxs("label", { className: "flex cursor-pointer items-center gap-2", children: [_jsx(Switch, { checked: config.settings.showLegend ?? true, onCheckedChange: (showLegend) => onChangeConfig('showLegend', showLegend), className: "h-4 w-7 data-[state=checked]:bg-gray-800 data-[state=unchecked]:bg-gray-300", children: _jsx(Switch.Thumb, { className: "h-3 w-3 data-[state=checked]:translate-x-3 data-[state=checked]:bg-white data-[state=unchecked]:bg-gray-800" }) }), _jsx("span", { className: "text-xs", children: "Show Legend" })] })] }));
|
|
23
14
|
};
|
|
24
15
|
//# sourceMappingURL=LineChartSettings.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LineChartSettings.js","sourceRoot":"","sources":["../../../../src/charts/chart-types/line-chart/LineChartSettings.tsx"],"names":[],"mappings":";AACA,OAAO,EAAC,KAAK,EAAC,MAAM,2BAA2B,CAAC;AAChD,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"LineChartSettings.js","sourceRoot":"","sources":["../../../../src/charts/chart-types/line-chart/LineChartSettings.tsx"],"names":[],"mappings":";AACA,OAAO,EAAC,KAAK,EAAC,MAAM,2BAA2B,CAAC;AAChD,OAAO,EAAC,MAAM,EAAC,MAAM,cAAc,CAAC;AACpC,OAAO,EAAC,6BAA6B,EAAC,MAAM,iDAAiD,CAAC;AAC9F,OAAO,EAAC,wBAAwB,EAAC,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAC,uBAAuB,EAAC,MAAM,2BAA2B,CAAC;AAElE;;;GAGG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAO,GAAG,EAAE;IACjD,MAAM,EAAC,cAAc,EAAE,MAAM,EAAC,GAAG,6BAA6B,CAAC,YAAY,CAAC,CAAC;IAE7E,OAAO,CACL,eAAK,SAAS,EAAC,WAAW,aACxB,KAAC,KAAK,IAAC,KAAK,EAAC,QAAQ,EAAC,QAAQ,kBAC5B,KAAC,uBAAuB,KAAG,GACrB,EAER,KAAC,KAAK,IAAC,KAAK,EAAC,QAAQ,EAAC,QAAQ,kBAC5B,KAAC,wBAAwB,KAAG,GACtB,EAER,iBAAO,SAAS,EAAC,wCAAwC,aACvD,KAAC,MAAM,IACL,OAAO,EAAE,MAAM,CAAC,QAAQ,CAAC,UAAU,IAAI,IAAI,EAC3C,eAAe,EAAE,CAAC,UAAU,EAAE,EAAE,CAC9B,cAAc,CAAC,YAAY,EAAE,UAAU,CAAC,EAE1C,SAAS,EAAC,6EAA6E,YAEvF,KAAC,MAAM,CAAC,KAAK,IAAC,SAAS,EAAC,6GAA6G,GAAG,GACjI,EACT,eAAM,SAAS,EAAC,SAAS,4BAAmB,IACtC,IACJ,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import {type FC} from 'react';\nimport {Field} from '../../../components/Field';\nimport {Switch} from '@sqlrooms/ui';\nimport {useMosaicChartSettingsContext} from '../../chart-settings/MosaicChartSettingsContext';\nimport {LineChartYFieldsSelector} from './LineChartYFieldsSelector';\nimport {LineChartXFieldSelector} from './LineChartXFieldSelector';\n\n/**\n * Explicit settings component for line chart.\n * Composes primitive and compound components for full control over the UI.\n */\nexport const LineChartSettingsComponent: FC = () => {\n const {onChangeConfig, config} = useMosaicChartSettingsContext('line-chart');\n\n return (\n <div className=\"space-y-4\">\n <Field label=\"X Axis\" required>\n <LineChartXFieldSelector />\n </Field>\n\n <Field label=\"Y Axis\" required>\n <LineChartYFieldsSelector />\n </Field>\n\n <label className=\"flex cursor-pointer items-center gap-2\">\n <Switch\n checked={config.settings.showLegend ?? true}\n onCheckedChange={(showLegend) =>\n onChangeConfig('showLegend', showLegend)\n }\n className=\"h-4 w-7 data-[state=checked]:bg-gray-800 data-[state=unchecked]:bg-gray-300\"\n >\n <Switch.Thumb className=\"h-3 w-3 data-[state=checked]:translate-x-3 data-[state=checked]:bg-white data-[state=unchecked]:bg-gray-800\" />\n </Switch>\n <span className=\"text-xs\">Show Legend</span>\n </label>\n </div>\n );\n};\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { FC } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Field selector specifically for line chart X-axis.
|
|
4
|
+
* Includes temporal granularity selector when X field is temporal.
|
|
5
|
+
*/
|
|
6
|
+
export declare const LineChartXFieldSelector: FC;
|
|
7
|
+
//# sourceMappingURL=LineChartXFieldSelector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LineChartXFieldSelector.d.ts","sourceRoot":"","sources":["../../../../src/charts/chart-types/line-chart/LineChartXFieldSelector.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,EAAE,EAAC,MAAM,OAAO,CAAC;AAO9B;;;GAGG;AACH,eAAO,MAAM,uBAAuB,EAAE,EA6BrC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ColumnSelector } from '../../../components/ColumnSelector';
|
|
3
|
+
import { TemporalGranularitySelector } from '../../../components/TemporalGranularitySelector';
|
|
4
|
+
import { useColumnsContext } from '../../../components/ColumnsContext';
|
|
5
|
+
import { isTemporalType } from '../../../column-types-utils';
|
|
6
|
+
import { useMosaicChartSettingsContext } from '../../chart-settings/MosaicChartSettingsContext';
|
|
7
|
+
/**
|
|
8
|
+
* Field selector specifically for line chart X-axis.
|
|
9
|
+
* Includes temporal granularity selector when X field is temporal.
|
|
10
|
+
*/
|
|
11
|
+
export const LineChartXFieldSelector = () => {
|
|
12
|
+
const { onChangeConfig, config } = useMosaicChartSettingsContext('line-chart');
|
|
13
|
+
const { columns } = useColumnsContext();
|
|
14
|
+
const xColumn = columns.find((c) => c.name === config.settings.x);
|
|
15
|
+
const isXFieldTemporal = xColumn && isTemporalType(xColumn.type);
|
|
16
|
+
return (_jsxs("div", { className: "grid items-end gap-2", style: {
|
|
17
|
+
gridTemplateColumns: isXFieldTemporal
|
|
18
|
+
? 'minmax(120px, 1fr) 100px'
|
|
19
|
+
: '1fr',
|
|
20
|
+
}, children: [_jsx(ColumnSelector.Quantitative, { value: config.settings.x, onChange: (x) => onChangeConfig('x', x) }), isXFieldTemporal && (_jsx(TemporalGranularitySelector, { value: config.settings.xInterval, onChange: (xInterval) => onChangeConfig('xInterval', xInterval), xFieldType: xColumn.type }))] }));
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=LineChartXFieldSelector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LineChartXFieldSelector.js","sourceRoot":"","sources":["../../../../src/charts/chart-types/line-chart/LineChartXFieldSelector.tsx"],"names":[],"mappings":";AACA,OAAO,EAAC,cAAc,EAAC,MAAM,oCAAoC,CAAC;AAClE,OAAO,EAAC,2BAA2B,EAAC,MAAM,iDAAiD,CAAC;AAC5F,OAAO,EAAC,iBAAiB,EAAC,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAC,cAAc,EAAC,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAC,6BAA6B,EAAC,MAAM,iDAAiD,CAAC;AAE9F;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAO,GAAG,EAAE;IAC9C,MAAM,EAAC,cAAc,EAAE,MAAM,EAAC,GAAG,6BAA6B,CAAC,YAAY,CAAC,CAAC;IAE7E,MAAM,EAAC,OAAO,EAAC,GAAG,iBAAiB,EAAE,CAAC;IACtC,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAClE,MAAM,gBAAgB,GAAG,OAAO,IAAI,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjE,OAAO,CACL,eACE,SAAS,EAAC,sBAAsB,EAChC,KAAK,EAAE;YACL,mBAAmB,EAAE,gBAAgB;gBACnC,CAAC,CAAC,0BAA0B;gBAC5B,CAAC,CAAC,KAAK;SACV,aAED,KAAC,cAAc,CAAC,YAAY,IAC1B,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,EACxB,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,cAAc,CAAC,GAAG,EAAE,CAAC,CAAC,GACvC,EACD,gBAAgB,IAAI,CACnB,KAAC,2BAA2B,IAC1B,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,SAAS,EAChC,QAAQ,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,cAAc,CAAC,WAAW,EAAE,SAAS,CAAC,EAC/D,UAAU,EAAE,OAAO,CAAC,IAAI,GACxB,CACH,IACG,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import type {FC} from 'react';\nimport {ColumnSelector} from '../../../components/ColumnSelector';\nimport {TemporalGranularitySelector} from '../../../components/TemporalGranularitySelector';\nimport {useColumnsContext} from '../../../components/ColumnsContext';\nimport {isTemporalType} from '../../../column-types-utils';\nimport {useMosaicChartSettingsContext} from '../../chart-settings/MosaicChartSettingsContext';\n\n/**\n * Field selector specifically for line chart X-axis.\n * Includes temporal granularity selector when X field is temporal.\n */\nexport const LineChartXFieldSelector: FC = () => {\n const {onChangeConfig, config} = useMosaicChartSettingsContext('line-chart');\n\n const {columns} = useColumnsContext();\n const xColumn = columns.find((c) => c.name === config.settings.x);\n const isXFieldTemporal = xColumn && isTemporalType(xColumn.type);\n\n return (\n <div\n className=\"grid items-end gap-2\"\n style={{\n gridTemplateColumns: isXFieldTemporal\n ? 'minmax(120px, 1fr) 100px'\n : '1fr',\n }}\n >\n <ColumnSelector.Quantitative\n value={config.settings.x}\n onChange={(x) => onChangeConfig('x', x)}\n />\n {isXFieldTemporal && (\n <TemporalGranularitySelector\n value={config.settings.xInterval}\n onChange={(xInterval) => onChangeConfig('xInterval', xInterval)}\n xFieldType={xColumn.type}\n />\n )}\n </div>\n );\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LineChartYFieldsSelector.d.ts","sourceRoot":"","sources":["../../../../src/charts/chart-types/line-chart/LineChartYFieldsSelector.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,EAAE,EAAC,MAAM,OAAO,CAAC;AAapD;;;GAGG;AACH,eAAO,MAAM,wBAAwB,EAAE,EAuEtC,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useMemo } from 'react';
|
|
3
|
+
import { MultiFieldSelector } from '../../../components/MultiFieldSelector';
|
|
4
|
+
import { AggregationSelector } from '../../../components/AggregationSelector';
|
|
5
|
+
import { ColorSelector } from '../../../components/ColorSelector';
|
|
6
|
+
import { useMosaicChartSettingsContext } from '../../chart-settings/MosaicChartSettingsContext';
|
|
7
|
+
import { useColumnsContext } from '../../../components/ColumnsContext';
|
|
8
|
+
import { isTemporalType } from '../../../column-types-utils';
|
|
9
|
+
import { getUnusedColor } from './utils';
|
|
10
|
+
import { DEFAULT_CHART_COLORS, DEFAULT_CHART_FALLBACK_COLOR, } from '../../../constants/chart-colors';
|
|
11
|
+
/**
|
|
12
|
+
* Field selector specifically for line chart Y-axis fields.
|
|
13
|
+
* Includes aggregation and color selection.
|
|
14
|
+
*/
|
|
15
|
+
export const LineChartYFieldsSelector = () => {
|
|
16
|
+
const { onChangeConfig, config } = useMosaicChartSettingsContext('line-chart');
|
|
17
|
+
const { columns } = useColumnsContext();
|
|
18
|
+
const yFields = useMemo(() => config.settings.yFields ?? [], [config.settings.yFields]);
|
|
19
|
+
const xColumn = columns.find((c) => c.name === config.settings.x);
|
|
20
|
+
const isXFieldTemporal = xColumn && isTemporalType(xColumn.type);
|
|
21
|
+
const showAggregation = Boolean(isXFieldTemporal && config.settings.xInterval);
|
|
22
|
+
const handleChange = useCallback((newYFields) => onChangeConfig('yFields', newYFields), [onChangeConfig]);
|
|
23
|
+
const handleAdd = useCallback((fieldName) => {
|
|
24
|
+
if (fieldName) {
|
|
25
|
+
const usedColors = yFields
|
|
26
|
+
.map((f) => f.color)
|
|
27
|
+
.filter((c) => Boolean(c));
|
|
28
|
+
onChangeConfig('yFields', [
|
|
29
|
+
...yFields,
|
|
30
|
+
{
|
|
31
|
+
field: fieldName,
|
|
32
|
+
aggregate: 'sum',
|
|
33
|
+
color: getUnusedColor(DEFAULT_CHART_COLORS, usedColors),
|
|
34
|
+
},
|
|
35
|
+
]);
|
|
36
|
+
}
|
|
37
|
+
}, [yFields, onChangeConfig]);
|
|
38
|
+
return (_jsx(MultiFieldSelector.Numeric, { value: yFields, onChange: handleChange, onAdd: handleAdd, renderItem: (fieldConfig, index, handleUpdate) => (_jsxs("div", { className: "grid items-end gap-2", style: {
|
|
39
|
+
gridTemplateColumns: showAggregation ? 'auto auto' : 'auto',
|
|
40
|
+
}, children: [showAggregation && (_jsx(AggregationSelector, { value: fieldConfig.aggregate || 'sum', onChange: (newAggregate) => handleUpdate(index, { aggregate: newAggregate }) })), _jsx(ColorSelector, { items: DEFAULT_CHART_COLORS, value: fieldConfig.color ?? DEFAULT_CHART_FALLBACK_COLOR, onChange: (color) => handleUpdate(index, { color }) })] })) }));
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=LineChartYFieldsSelector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LineChartYFieldsSelector.js","sourceRoot":"","sources":["../../../../src/charts/chart-types/line-chart/LineChartYFieldsSelector.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,WAAW,EAAE,OAAO,EAAU,MAAM,OAAO,CAAC;AACpD,OAAO,EAAC,kBAAkB,EAAC,MAAM,wCAAwC,CAAC;AAC1E,OAAO,EAAC,mBAAmB,EA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AAC;AACJ,CAAC,CAAC","sourcesContent":["import {useCallback, useMemo, type FC} from 'react';\nimport {MultiFieldSelector} from '../../../components/MultiFieldSelector';\nimport {AggregationSelector} from '../../../components/AggregationSelector';\nimport {ColorSelector} from '../../../components/ColorSelector';\nimport {useMosaicChartSettingsContext} from '../../chart-settings/MosaicChartSettingsContext';\nimport {useColumnsContext} from '../../../components/ColumnsContext';\nimport {isTemporalType} from '../../../column-types-utils';\nimport {getUnusedColor} from './utils';\nimport {\n DEFAULT_CHART_COLORS,\n DEFAULT_CHART_FALLBACK_COLOR,\n} from '../../../constants/chart-colors';\n\n/**\n * Field selector specifically for line chart Y-axis fields.\n * Includes aggregation and color selection.\n */\nexport const LineChartYFieldsSelector: FC = () => {\n const {onChangeConfig, config} = useMosaicChartSettingsContext('line-chart');\n const {columns} = useColumnsContext();\n\n const yFields = useMemo(\n () => config.settings.yFields ?? [],\n [config.settings.yFields],\n );\n\n const xColumn = columns.find((c) => c.name === config.settings.x);\n const isXFieldTemporal = xColumn && isTemporalType(xColumn.type);\n\n const showAggregation = Boolean(\n isXFieldTemporal && config.settings.xInterval,\n );\n\n const handleChange = useCallback(\n (newYFields: typeof yFields) => onChangeConfig('yFields', newYFields),\n [onChangeConfig],\n );\n\n const handleAdd = useCallback(\n (fieldName: string) => {\n if (fieldName) {\n const usedColors = yFields\n .map((f) => f.color)\n .filter((c): c is string => Boolean(c));\n\n onChangeConfig('yFields', [\n ...yFields,\n {\n field: fieldName,\n aggregate: 'sum',\n color: getUnusedColor(DEFAULT_CHART_COLORS, usedColors),\n },\n ]);\n }\n },\n [yFields, onChangeConfig],\n );\n\n return (\n <MultiFieldSelector.Numeric\n value={yFields}\n onChange={handleChange}\n onAdd={handleAdd}\n renderItem={(fieldConfig, index, handleUpdate) => (\n <div\n className=\"grid items-end gap-2\"\n style={{\n gridTemplateColumns: showAggregation ? 'auto auto' : 'auto',\n }}\n >\n {showAggregation && (\n <AggregationSelector\n value={fieldConfig.aggregate || 'sum'}\n onChange={(newAggregate) =>\n handleUpdate(index, {aggregate: newAggregate})\n }\n />\n )}\n\n <ColorSelector\n items={DEFAULT_CHART_COLORS}\n value={fieldConfig.color ?? DEFAULT_CHART_FALLBACK_COLOR}\n onChange={(color) => handleUpdate(index, {color})}\n />\n </div>\n )}\n />\n );\n};\n"]}
|