@mwater/visualization 5.4.5 → 5.6.0
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/lib/MWaterContextComponent.d.ts +1 -1
- package/lib/MWaterContextComponent.js +1 -1
- package/lib/MWaterGlobalFiltersComponent.d.ts +2 -2
- package/lib/MWaterGlobalFiltersComponent.js +11 -20
- package/lib/MWaterLoaderComponent.d.ts +5 -14
- package/lib/MWaterLoaderComponent.js +2 -11
- package/lib/UndoStack.d.ts +2 -1
- package/lib/UndoStack.js +12 -6
- package/lib/dashboards/DashboardComponent.js +7 -5
- package/lib/dashboards/DashboardDesign.d.ts +1 -1
- package/lib/dashboards/LayoutOptionsComponent.js +18 -11
- package/lib/dashboards/ServerDashboardDataSource.d.ts +10 -1
- package/lib/dashboards/ServerDashboardDataSource.js +29 -10
- package/lib/dashboards/SettingsModalComponent.js +1 -1
- package/lib/dashboards/layoutOptions.d.ts +5 -1
- package/lib/datagrids/DatagridComponent.js +23 -3
- package/lib/datagrids/DatagridDesignerComponent.d.ts +2 -3
- package/lib/datagrids/DatagridDesignerComponent.js +108 -120
- package/lib/datagrids/DatagridViewComponent.js +3 -2
- package/lib/datagrids/ExprCellComponent.d.ts +1 -0
- package/lib/datagrids/ExprCellComponent.js +22 -20
- package/lib/datagrids/OrderBysDesignerComponent.d.ts +7 -7
- package/lib/datagrids/OrderBysDesignerComponent.js +19 -28
- package/lib/index.css +45 -2
- package/lib/index.d.ts +5 -5
- package/lib/index.js +2 -3
- package/lib/layouts/blocks/BlocksDisplayComponent.d.ts +8 -1
- package/lib/layouts/blocks/BlocksDisplayComponent.js +46 -4
- package/lib/maps/BufferLayer.d.ts +18 -0
- package/lib/maps/BufferLayer.js +36 -14
- package/lib/maps/BufferLayerDesign.d.ts +1 -1
- package/lib/maps/BufferLayerDesignerComponent.js +2 -2
- package/lib/maps/ChoroplethLayer.d.ts +18 -0
- package/lib/maps/ChoroplethLayer.js +46 -25
- package/lib/maps/ChoroplethLayerDesign.d.ts +7 -3
- package/lib/maps/ChoroplethLayerDesigner.d.ts +10 -22
- package/lib/maps/ChoroplethLayerDesigner.js +58 -89
- package/lib/maps/DirectMapDataSource.js +17 -10
- package/lib/maps/EditHoverOver.d.ts +4 -3
- package/lib/maps/EditHoverOver.js +64 -35
- package/lib/maps/HoverContent.d.ts +10 -5
- package/lib/maps/HoverContent.js +7 -36
- package/lib/maps/Layer.d.ts +37 -0
- package/lib/maps/Layer.js +30 -4
- package/lib/maps/LeafletMapComponent.js +10 -19
- package/lib/maps/MWaterServerLayer.d.ts +2 -2
- package/lib/maps/MWaterServerLayer.js +6 -6
- package/lib/maps/MapComponent.js +0 -1
- package/lib/maps/MapLayerDataSource.d.ts +9 -0
- package/lib/maps/MapUtils.d.ts +19 -1
- package/lib/maps/MapUtils.js +80 -1
- package/lib/maps/MarkersLayer.d.ts +18 -0
- package/lib/maps/MarkersLayer.js +42 -26
- package/lib/maps/MarkersLayerDesign.d.ts +1 -1
- package/lib/maps/MarkersLayerDesignerComponent.d.ts +12 -28
- package/lib/maps/MarkersLayerDesignerComponent.js +81 -111
- package/lib/maps/RasterMapViewComponent.js +1 -1
- package/lib/maps/ServerMapDataSource.d.ts +9 -0
- package/lib/maps/ServerMapDataSource.js +29 -10
- package/lib/maps/VectorMapViewComponent.js +7 -15
- package/lib/maps/maps.d.ts +4 -2
- package/lib/maps/symbols/font-awesome/asterisk.png +0 -0
- package/lib/maps/symbols/font-awesome/ban.png +0 -0
- package/lib/maps/symbols/font-awesome/beer.png +0 -0
- package/lib/maps/symbols/font-awesome/bell.png +0 -0
- package/lib/maps/symbols/font-awesome/bolt.png +0 -0
- package/lib/maps/symbols/font-awesome/building.png +0 -0
- package/lib/maps/symbols/font-awesome/bullseye.png +0 -0
- package/lib/maps/symbols/font-awesome/bus.png +0 -0
- package/lib/maps/symbols/font-awesome/caret-up.png +0 -0
- package/lib/maps/symbols/font-awesome/certificate.png +0 -0
- package/lib/maps/symbols/font-awesome/check-circle.png +0 -0
- package/lib/maps/symbols/font-awesome/check.png +0 -0
- package/lib/maps/symbols/font-awesome/chevron-circle-down.png +0 -0
- package/lib/maps/symbols/font-awesome/chevron-circle-up.png +0 -0
- package/lib/maps/symbols/font-awesome/cloud-rain.png +0 -0
- package/lib/maps/symbols/font-awesome/cloud.png +0 -0
- package/lib/maps/symbols/font-awesome/comment.png +0 -0
- package/lib/maps/symbols/font-awesome/crosshairs.png +0 -0
- package/lib/maps/symbols/font-awesome/dot-circle-o.png +0 -0
- package/lib/maps/symbols/font-awesome/exclamation-circle.png +0 -0
- package/lib/maps/symbols/font-awesome/exclamation-triangle.png +0 -0
- package/lib/maps/symbols/font-awesome/female.png +0 -0
- package/lib/maps/symbols/font-awesome/file.png +0 -0
- package/lib/maps/symbols/font-awesome/flag.png +0 -0
- package/lib/maps/symbols/font-awesome/flask.png +0 -0
- package/lib/maps/symbols/font-awesome/h-square.png +0 -0
- package/lib/maps/symbols/font-awesome/home.png +0 -0
- package/lib/maps/symbols/font-awesome/info-circle.png +0 -0
- package/lib/maps/symbols/font-awesome/male.png +0 -0
- package/lib/maps/symbols/font-awesome/medkit.png +0 -0
- package/lib/maps/symbols/font-awesome/mobile.png +0 -0
- package/lib/maps/symbols/font-awesome/plus-circle.png +0 -0
- package/lib/maps/symbols/font-awesome/plus-square.png +0 -0
- package/lib/maps/symbols/font-awesome/plus.png +0 -0
- package/lib/maps/symbols/font-awesome/square.png +0 -0
- package/lib/maps/symbols/font-awesome/star.png +0 -0
- package/lib/maps/symbols/font-awesome/thumbs-down.png +0 -0
- package/lib/maps/symbols/font-awesome/thumbs-up.png +0 -0
- package/lib/maps/symbols/font-awesome/ticket.png +0 -0
- package/lib/maps/symbols/font-awesome/times-circle.png +0 -0
- package/lib/maps/symbols/font-awesome/times.png +0 -0
- package/lib/maps/symbols/font-awesome/tint.png +0 -0
- package/lib/maps/symbols/font-awesome/tree.png +0 -0
- package/lib/maps/symbols/font-awesome/university.png +0 -0
- package/lib/maps/symbols/font-awesome/usd.png +0 -0
- package/lib/maps/symbols/font-awesome/user.png +0 -0
- package/lib/maps/symbols/font-awesome/users.png +0 -0
- package/lib/maps/symbols/font-awesome/wheelchair.png +0 -0
- package/lib/maps/symbols/sdf-ize.sh +93 -0
- package/lib/maps/vectorMaps.d.ts +1 -0
- package/lib/maps/vectorMaps.js +20 -36
- package/lib/mwater_table_selection/FormsListComponent.d.ts +33 -0
- package/lib/mwater_table_selection/FormsListComponent.js +141 -0
- package/lib/mwater_table_selection/IndicatorsListComponent.d.ts +49 -0
- package/lib/mwater_table_selection/IndicatorsListComponent.js +251 -0
- package/lib/mwater_table_selection/IssuesListComponent.d.ts +29 -0
- package/lib/mwater_table_selection/IssuesListComponent.js +123 -0
- package/lib/mwater_table_selection/MWaterAccountingSystemListComponent.d.ts +20 -0
- package/lib/mwater_table_selection/MWaterAccountingSystemListComponent.js +157 -0
- package/lib/mwater_table_selection/MWaterAssetSystemsListComponent.d.ts +17 -0
- package/lib/mwater_table_selection/MWaterAssetSystemsListComponent.js +79 -0
- package/lib/mwater_table_selection/MWaterCalculatedDataSourcesListComponent.d.ts +18 -0
- package/lib/mwater_table_selection/MWaterCalculatedDataSourcesListComponent.js +80 -0
- package/lib/mwater_table_selection/MWaterCompleteTableSelectComponent.d.ts +63 -0
- package/lib/mwater_table_selection/MWaterCompleteTableSelectComponent.js +461 -0
- package/lib/mwater_table_selection/MWaterCustomTablesetListComponent.d.ts +17 -0
- package/lib/mwater_table_selection/MWaterCustomTablesetListComponent.js +94 -0
- package/lib/mwater_table_selection/MWaterMetricsTableListComponent.d.ts +17 -0
- package/lib/mwater_table_selection/MWaterMetricsTableListComponent.js +80 -0
- package/lib/mwater_table_selection/MWaterTableSelectComponent.d.ts +32 -0
- package/lib/mwater_table_selection/MWaterTableSelectComponent.js +163 -0
- package/lib/mwater_table_selection/MWaterWorkflowsSelectComponent.d.ts +19 -0
- package/lib/mwater_table_selection/MWaterWorkflowsSelectComponent.js +111 -0
- package/lib/quickfilter/QuickfiltersComponent.d.ts +3 -102
- package/lib/quickfilter/QuickfiltersComponent.js +53 -110
- package/lib/quickfilter/TextLiteralComponent.d.ts +23 -47
- package/lib/quickfilter/TextLiteralComponent.js +85 -82
- package/lib/widgets/MapWidget.js +4 -2
- package/lib/widgets/charts/Chart.d.ts +11 -0
- package/lib/widgets/charts/Chart.js +15 -0
- package/lib/widgets/charts/ChartWidgetComponent.d.ts +1 -0
- package/lib/widgets/charts/ChartWidgetComponent.js +27 -1
- package/lib/widgets/charts/layered/LayeredChartDesign.d.ts +1 -1
- package/lib/widgets/charts/layered/LayeredChartDesignerComponent.d.ts +1 -1
- package/lib/widgets/charts/layered/LayeredChartDesignerComponent.js +5 -12
- package/lib/widgets/charts/layered/LayeredChartLayerDesignerComponent.d.ts +43 -57
- package/lib/widgets/charts/layered/LayeredChartLayerDesignerComponent.js +113 -110
- package/lib/widgets/charts/layered/LayeredChartUtils.d.ts +2 -1
- package/lib/widgets/charts/layered/LayeredChartUtils.js +0 -2
- package/lib/widgets/charts/pivot/PivotChart.d.ts +2 -0
- package/lib/widgets/charts/pivot/PivotChart.js +156 -0
- package/lib/widgets/charts/pivot/PivotChartDesignerComponent.d.ts +5 -20
- package/lib/widgets/charts/pivot/PivotChartDesignerComponent.js +31 -61
- package/lib/widgets/charts/pivot/PivotChartLayoutBuilder.d.ts +4 -0
- package/lib/widgets/charts/pivot/PivotChartLayoutBuilder.js +4 -2
- package/lib/widgets/charts/pivot/PivotChartLayoutComponent.d.ts +5 -44
- package/lib/widgets/charts/pivot/PivotChartLayoutComponent.js +38 -63
- package/lib/widgets/charts/pivot/SegmentDesignerComponent.d.ts +7 -68
- package/lib/widgets/charts/pivot/SegmentDesignerComponent.js +58 -106
- package/lib/widgets/charts/table/TableChart.d.ts +2 -0
- package/lib/widgets/charts/table/TableChart.js +172 -1
- package/lib/widgets/charts/table/TableChartDesignerComponent.d.ts +7 -17
- package/lib/widgets/charts/table/TableChartDesignerComponent.js +79 -95
- package/lib/widgets/charts/table/TableChartViewComponent.d.ts +1 -7
- package/lib/widgets/charts/table/TableChartViewComponent.js +19 -27
- package/lib/widgets/text/ExprItemEditorComponent.d.ts +3 -8
- package/lib/widgets/text/ExprItemEditorComponent.js +36 -33
- package/lib/widgets/text/ExprUpdateModalComponent.d.ts +1 -0
- package/package.json +4 -10
- package/src/MWaterContextComponent.tsx +2 -2
- package/src/{MWaterGlobalFiltersComponent.ts → MWaterGlobalFiltersComponent.tsx} +32 -33
- package/src/{MWaterLoaderComponent.ts → MWaterLoaderComponent.tsx} +18 -19
- package/src/UndoStack.ts +14 -6
- package/src/dashboards/DashboardComponent.tsx +7 -5
- package/src/dashboards/DashboardDesign.ts +1 -1
- package/src/dashboards/LayoutOptionsComponent.tsx +22 -10
- package/src/dashboards/ServerDashboardDataSource.ts +36 -13
- package/src/dashboards/SettingsModalComponent.tsx +1 -1
- package/src/dashboards/layoutOptions.tsx +5 -1
- package/src/datagrids/DatagridComponent.tsx +31 -3
- package/src/datagrids/DatagridDesignerComponent.tsx +241 -229
- package/src/datagrids/DatagridViewComponent.tsx +3 -2
- package/src/datagrids/ExprCellComponent.tsx +23 -20
- package/src/datagrids/OrderBysDesignerComponent.tsx +61 -70
- package/src/index.css +45 -2
- package/src/index.ts +5 -11
- package/src/layouts/blocks/BlocksDisplayComponent.tsx +60 -5
- package/src/maps/BufferLayer.ts +48 -20
- package/src/maps/BufferLayerDesign.ts +1 -1
- package/src/maps/BufferLayerDesignerComponent.tsx +2 -1
- package/src/maps/ChoroplethLayer.ts +70 -39
- package/src/maps/ChoroplethLayerDesign.ts +6 -2
- package/src/maps/ChoroplethLayerDesigner.tsx +171 -167
- package/src/maps/DirectMapDataSource.ts +21 -13
- package/src/maps/EditHoverOver.tsx +98 -54
- package/src/maps/HoverContent.tsx +17 -48
- package/src/maps/Layer.ts +42 -4
- package/src/maps/LeafletMapComponent.tsx +10 -19
- package/src/maps/MWaterServerLayer.ts +6 -6
- package/src/maps/MapComponent.ts +0 -1
- package/src/maps/MapLayerDataSource.ts +8 -0
- package/src/maps/MapUtils.ts +82 -3
- package/src/maps/MarkersLayer.ts +54 -27
- package/src/maps/MarkersLayerDesign.ts +1 -1
- package/src/maps/MarkersLayerDesignerComponent.tsx +360 -0
- package/src/maps/RasterMapViewComponent.ts +1 -1
- package/src/maps/ServerMapDataSource.ts +35 -12
- package/src/maps/VectorMapViewComponent.tsx +8 -19
- package/src/maps/maps.ts +4 -2
- package/src/maps/symbols/font-awesome/asterisk.png +0 -0
- package/src/maps/symbols/font-awesome/ban.png +0 -0
- package/src/maps/symbols/font-awesome/beer.png +0 -0
- package/src/maps/symbols/font-awesome/bell.png +0 -0
- package/src/maps/symbols/font-awesome/bolt.png +0 -0
- package/src/maps/symbols/font-awesome/building.png +0 -0
- package/src/maps/symbols/font-awesome/bullseye.png +0 -0
- package/src/maps/symbols/font-awesome/bus.png +0 -0
- package/src/maps/symbols/font-awesome/caret-up.png +0 -0
- package/src/maps/symbols/font-awesome/certificate.png +0 -0
- package/src/maps/symbols/font-awesome/check-circle.png +0 -0
- package/src/maps/symbols/font-awesome/check.png +0 -0
- package/src/maps/symbols/font-awesome/chevron-circle-down.png +0 -0
- package/src/maps/symbols/font-awesome/chevron-circle-up.png +0 -0
- package/src/maps/symbols/font-awesome/cloud-rain.png +0 -0
- package/src/maps/symbols/font-awesome/cloud.png +0 -0
- package/src/maps/symbols/font-awesome/comment.png +0 -0
- package/src/maps/symbols/font-awesome/crosshairs.png +0 -0
- package/src/maps/symbols/font-awesome/dot-circle-o.png +0 -0
- package/src/maps/symbols/font-awesome/exclamation-circle.png +0 -0
- package/src/maps/symbols/font-awesome/exclamation-triangle.png +0 -0
- package/src/maps/symbols/font-awesome/female.png +0 -0
- package/src/maps/symbols/font-awesome/file.png +0 -0
- package/src/maps/symbols/font-awesome/flag.png +0 -0
- package/src/maps/symbols/font-awesome/flask.png +0 -0
- package/src/maps/symbols/font-awesome/h-square.png +0 -0
- package/src/maps/symbols/font-awesome/home.png +0 -0
- package/src/maps/symbols/font-awesome/info-circle.png +0 -0
- package/src/maps/symbols/font-awesome/male.png +0 -0
- package/src/maps/symbols/font-awesome/medkit.png +0 -0
- package/src/maps/symbols/font-awesome/mobile.png +0 -0
- package/src/maps/symbols/font-awesome/plus-circle.png +0 -0
- package/src/maps/symbols/font-awesome/plus-square.png +0 -0
- package/src/maps/symbols/font-awesome/plus.png +0 -0
- package/src/maps/symbols/font-awesome/square.png +0 -0
- package/src/maps/symbols/font-awesome/star.png +0 -0
- package/src/maps/symbols/font-awesome/thumbs-down.png +0 -0
- package/src/maps/symbols/font-awesome/thumbs-up.png +0 -0
- package/src/maps/symbols/font-awesome/ticket.png +0 -0
- package/src/maps/symbols/font-awesome/times-circle.png +0 -0
- package/src/maps/symbols/font-awesome/times.png +0 -0
- package/src/maps/symbols/font-awesome/tint.png +0 -0
- package/src/maps/symbols/font-awesome/tree.png +0 -0
- package/src/maps/symbols/font-awesome/university.png +0 -0
- package/src/maps/symbols/font-awesome/usd.png +0 -0
- package/src/maps/symbols/font-awesome/user.png +0 -0
- package/src/maps/symbols/font-awesome/users.png +0 -0
- package/src/maps/symbols/font-awesome/wheelchair.png +0 -0
- package/src/maps/symbols/sdf-ize.sh +93 -0
- package/src/maps/vectorMaps.tsx +20 -44
- package/src/mwater_table_selection/FormsListComponent.tsx +188 -0
- package/src/mwater_table_selection/IndicatorsListComponent.tsx +411 -0
- package/src/mwater_table_selection/IssuesListComponent.tsx +167 -0
- package/src/mwater_table_selection/MWaterAccountingSystemListComponent.tsx +225 -0
- package/src/{MWaterAssetSystemsListComponent.tsx → mwater_table_selection/MWaterAssetSystemsListComponent.tsx} +2 -2
- package/src/mwater_table_selection/MWaterCalculatedDataSourcesListComponent.tsx +111 -0
- package/src/mwater_table_selection/MWaterCompleteTableSelectComponent.tsx +713 -0
- package/src/{MWaterCustomTablesetListComponent.tsx → mwater_table_selection/MWaterCustomTablesetListComponent.tsx} +1 -1
- package/src/{MWaterMetricsTableListComponent.tsx → mwater_table_selection/MWaterMetricsTableListComponent.tsx} +1 -1
- package/src/{MWaterTableSelectComponent.tsx → mwater_table_selection/MWaterTableSelectComponent.tsx} +91 -90
- package/src/mwater_table_selection/MWaterWorkflowsSelectComponent.tsx +159 -0
- package/src/quickfilter/{QuickfiltersComponent.ts → QuickfiltersComponent.tsx} +165 -158
- package/src/quickfilter/TextLiteralComponent.tsx +197 -0
- package/src/widgets/MapWidget.tsx +9 -1
- package/src/widgets/charts/Chart.ts +17 -0
- package/src/widgets/charts/ChartWidgetComponent.tsx +36 -1
- package/src/widgets/charts/layered/LayeredChartDesign.ts +1 -1
- package/src/widgets/charts/layered/LayeredChartDesignerComponent.tsx +23 -24
- package/src/widgets/charts/layered/LayeredChartLayerDesignerComponent.tsx +260 -211
- package/src/widgets/charts/layered/LayeredChartUtils.ts +7 -7
- package/src/widgets/charts/pivot/PivotChart.ts +191 -0
- package/src/widgets/charts/pivot/PivotChartDesignerComponent.tsx +124 -129
- package/src/widgets/charts/pivot/PivotChartLayoutBuilder.ts +4 -2
- package/src/widgets/charts/pivot/PivotChartLayoutComponent.tsx +120 -149
- package/src/widgets/charts/pivot/SegmentDesignerComponent.tsx +178 -198
- package/src/widgets/charts/table/TableChart.ts +177 -1
- package/src/widgets/charts/table/TableChartDesignerComponent.tsx +422 -0
- package/src/widgets/charts/table/{TableChartViewComponent.ts → TableChartViewComponent.tsx} +65 -60
- package/src/widgets/text/ExprItemEditorComponent.tsx +83 -77
- package/src/widgets/text/ExprUpdateModalComponent.tsx +1 -0
- package/test/UndoStackTests.ts +52 -1
- package/.storybook/config.js +0 -7
- package/.storybook/head.html +0 -4
- package/.storybook/webpack.config.js +0 -15
- package/src/MWaterCompleteTableSelectComponent.tsx +0 -975
- package/src/maps/BingLayer.ts +0 -146
- package/src/maps/MarkersLayerDesignerComponent.ts +0 -374
- package/src/quickfilter/TextLiteralComponent.ts +0 -165
- package/src/widgets/charts/table/TableChartDesignerComponent.ts +0 -441
- package/stories/UpdateableComponent.js +0 -29
- package/stories/consoles.js +0 -202
- package/stories/dashboards.js +0 -217
- package/stories/datagridDesign.js +0 -114
- package/stories/datagrids.js +0 -69
- package/stories/dates.js +0 -80
- package/stories/exprcomponent.js +0 -43
- package/stories/index.js +0 -18
- package/stories/leaflet.js +0 -59
- package/stories/maps.js +0 -24
- package/stories/pivotChart.js +0 -235
|
@@ -69,6 +69,28 @@ class ChartWidgetComponent extends react_1.default.PureComponent {
|
|
|
69
69
|
return FileSaver.saveAs(blob, "Exported Data.csv");
|
|
70
70
|
});
|
|
71
71
|
};
|
|
72
|
+
// Saves an xlsx file to disk
|
|
73
|
+
handleSaveXlsxFile = () => {
|
|
74
|
+
// Get the data
|
|
75
|
+
this.props.widgetDataSource.getData(this.props.design, this.props.filters, (err, data) => {
|
|
76
|
+
if (err) {
|
|
77
|
+
console.error(err);
|
|
78
|
+
alert(T `Failed to get data: ${err.message}`);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
try {
|
|
82
|
+
// Create workbook
|
|
83
|
+
const blob = this.props.chart.createXlsxWorkbook(this.props.design, this.props.schema, this.props.dataSource, data, this.context);
|
|
84
|
+
// Require at use as causes server problems
|
|
85
|
+
const FileSaver = require("file-saver");
|
|
86
|
+
FileSaver.saveAs(blob, "Exported Data.xlsx");
|
|
87
|
+
}
|
|
88
|
+
catch (ex) {
|
|
89
|
+
console.error(ex);
|
|
90
|
+
alert(T `Failed to export data: ${ex.message}`);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
};
|
|
72
94
|
handleStartEditing = () => {
|
|
73
95
|
// Can't edit if already editing
|
|
74
96
|
if (this.state.editDesign) {
|
|
@@ -149,7 +171,11 @@ class ChartWidgetComponent extends react_1.default.PureComponent {
|
|
|
149
171
|
// Create dropdown items
|
|
150
172
|
const dropdownItems = this.props.chart.createDropdownItems(design, this.props.schema, this.props.widgetDataSource, this.props.filters);
|
|
151
173
|
if (!designError) {
|
|
152
|
-
dropdownItems.push({ label: T `Export Data`, onClick: this.handleSaveCsvFile });
|
|
174
|
+
dropdownItems.push({ label: T `Export Data (CSV)`, onClick: this.handleSaveCsvFile });
|
|
175
|
+
// Add XLSX export option if supported
|
|
176
|
+
if (this.props.chart.supportsXlsxExport()) {
|
|
177
|
+
dropdownItems.push({ label: T `Export Data (XLSX)`, onClick: this.handleSaveXlsxFile });
|
|
178
|
+
}
|
|
153
179
|
}
|
|
154
180
|
if (this.props.onDesignChange != null) {
|
|
155
181
|
dropdownItems.unshift({
|
|
@@ -45,7 +45,7 @@ export interface LayeredChartDesign {
|
|
|
45
45
|
}
|
|
46
46
|
export interface LayeredChartDesignLayer {
|
|
47
47
|
/** bar/line/spline/scatter/area/pie/donut (overrides main one) */
|
|
48
|
-
type
|
|
48
|
+
type?: "bar" | "line" | "spline" | "scatter" | "area" | "pie" | "donut";
|
|
49
49
|
/** table of layer */
|
|
50
50
|
table: string;
|
|
51
51
|
/** label for layer (optional) */
|
|
@@ -36,7 +36,7 @@ export default class LayeredChartDesignerComponent extends React.Component<Layer
|
|
|
36
36
|
handleXAxisTickMultilineChange: (value: boolean) => void;
|
|
37
37
|
renderLabels(): React.DetailedReactHTMLElement<React.HTMLAttributes<HTMLElement>, HTMLElement> | undefined;
|
|
38
38
|
renderChartOptions(): React.JSX.Element;
|
|
39
|
-
renderType(): React.
|
|
39
|
+
renderType(): React.JSX.Element;
|
|
40
40
|
renderLayer: (index: any) => React.DetailedReactHTMLElement<{
|
|
41
41
|
style: {
|
|
42
42
|
paddingTop: number;
|
|
@@ -154,24 +154,17 @@ class LayeredChartDesignerComponent extends react_1.default.Component {
|
|
|
154
154
|
{ id: "scatter", name: T `Scatter`, desc: T `Show correlation between two number variables` },
|
|
155
155
|
{ id: "area", name: T `Area`, desc: T `For cumulative data over time` }
|
|
156
156
|
];
|
|
157
|
-
const current =
|
|
158
|
-
return
|
|
159
|
-
forceOpen: !this.props.design.type,
|
|
160
|
-
label: current ? current.name : "",
|
|
161
|
-
editor: (onClose) => {
|
|
162
|
-
return R(uiComponents.OptionListComponent, {
|
|
163
|
-
hint: T `Select a Chart Type`,
|
|
164
|
-
items: lodash_1.default.map(chartTypes, ct => ({
|
|
157
|
+
const current = chartTypes.find(ct => ct.id === this.props.design.type);
|
|
158
|
+
return (react_1.default.createElement(uiComponents.SectionComponent, { label: T `Chart Type` },
|
|
159
|
+
react_1.default.createElement(uiComponents.ToggleEditComponent, { forceOpen: !this.props.design.type, label: current ? current.name : "", editor: (onClose) => (react_1.default.createElement(uiComponents.OptionListComponent, { hint: T `Select a Chart Type`, items: chartTypes.map(ct => ({
|
|
165
160
|
name: ct.name,
|
|
166
161
|
desc: ct.desc,
|
|
167
162
|
onClick: () => {
|
|
168
163
|
onClose(); // Close editor first
|
|
169
164
|
return this.handleTypeChange(ct.id);
|
|
170
165
|
}
|
|
171
|
-
}))
|
|
172
|
-
|
|
173
|
-
}
|
|
174
|
-
}), this.renderOptions());
|
|
166
|
+
})) })) }),
|
|
167
|
+
this.renderOptions()));
|
|
175
168
|
}
|
|
176
169
|
renderLayer = (index) => {
|
|
177
170
|
const style = {
|
|
@@ -1,66 +1,52 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { DataSource, Schema } from "@mwater/expressions";
|
|
3
|
-
import
|
|
2
|
+
import { DataSource, Schema, LiteralType, Expr } from "@mwater/expressions";
|
|
3
|
+
import { LayeredChartDesignLayer, LayeredChartDesign } from "./LayeredChartDesign";
|
|
4
|
+
import { Axis } from "../../../axes/Axis";
|
|
5
|
+
import { JsonQLFilter } from "@mwater/visualization";
|
|
4
6
|
export interface LayeredChartLayerDesignerComponentProps {
|
|
5
|
-
design:
|
|
7
|
+
design: LayeredChartDesign;
|
|
6
8
|
schema: Schema;
|
|
7
9
|
dataSource: DataSource;
|
|
8
10
|
index: number;
|
|
9
|
-
onChange:
|
|
10
|
-
onRemove:
|
|
11
|
-
filters?:
|
|
11
|
+
onChange: (layer: LayeredChartDesignLayer) => void;
|
|
12
|
+
onRemove: () => void;
|
|
13
|
+
filters?: JsonQLFilter[];
|
|
12
14
|
}
|
|
13
15
|
export default class LayeredChartLayerDesignerComponent extends React.Component<LayeredChartLayerDesignerComponentProps> {
|
|
14
|
-
isLayerPolar(layer:
|
|
15
|
-
doesLayerNeedGrouping(layer:
|
|
16
|
-
isXAxisRequired(layer:
|
|
17
|
-
getAxisTypes(layer:
|
|
18
|
-
getAxisLabel(icon: any, label: any): React.
|
|
19
|
-
getXAxisLabel(layer:
|
|
20
|
-
getYAxisLabel(layer:
|
|
21
|
-
getColorAxisLabel(layer:
|
|
22
|
-
updateLayer(changes:
|
|
23
|
-
updateAxes(changes:
|
|
24
|
-
handleNameChange: (ev: any) =>
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
placeholder: string;
|
|
41
|
-
}, HTMLElement>;
|
|
42
|
-
renderRemove(): React.DetailedReactHTMLElement<{
|
|
43
|
-
className: string;
|
|
44
|
-
type: string;
|
|
45
|
-
onClick: any;
|
|
46
|
-
}, HTMLElement> | null;
|
|
47
|
-
renderTable(): React.CElement<uiComponents.SectionComponentProps, uiComponents.SectionComponent>;
|
|
16
|
+
isLayerPolar(layer: LayeredChartDesignLayer): boolean;
|
|
17
|
+
doesLayerNeedGrouping(layer: LayeredChartDesignLayer): boolean;
|
|
18
|
+
isXAxisRequired(layer: LayeredChartDesignLayer): boolean;
|
|
19
|
+
getAxisTypes(layer: LayeredChartDesignLayer, axisKey: any): LiteralType[] | undefined;
|
|
20
|
+
getAxisLabel(icon: any, label: any): React.JSX.Element;
|
|
21
|
+
getXAxisLabel(layer: LayeredChartDesignLayer): React.JSX.Element;
|
|
22
|
+
getYAxisLabel(layer: LayeredChartDesignLayer): React.JSX.Element;
|
|
23
|
+
getColorAxisLabel(layer: LayeredChartDesignLayer): React.JSX.Element;
|
|
24
|
+
updateLayer(changes: Partial<LayeredChartDesignLayer>): void;
|
|
25
|
+
updateAxes(changes: Partial<LayeredChartDesignLayer["axes"]>): void;
|
|
26
|
+
handleNameChange: (ev: any) => void;
|
|
27
|
+
handleLayerTypeChange: (type: LayeredChartDesignLayer["type"]) => void;
|
|
28
|
+
handleTableChange: (table: string) => void;
|
|
29
|
+
handleXAxisChange: (axis: Axis) => void;
|
|
30
|
+
handleXColorMapChange: (xColorMap: boolean) => void;
|
|
31
|
+
handleColorAxisChange: (axis: Axis) => void;
|
|
32
|
+
handleYAxisChange: (axis: Axis) => void;
|
|
33
|
+
handleFilterChange: (filter: Expr) => void;
|
|
34
|
+
handleColorChange: (color: string) => void;
|
|
35
|
+
handleCumulativeChange: (value: boolean) => void;
|
|
36
|
+
handleTrendlineChange: (value: boolean) => void;
|
|
37
|
+
handleStackedChange: (value: boolean) => void;
|
|
38
|
+
renderName(): React.JSX.Element;
|
|
39
|
+
renderRemove(): React.JSX.Element | undefined;
|
|
40
|
+
renderTable(): React.JSX.Element;
|
|
41
|
+
renderLayerTypeSelector(): React.JSX.Element | null;
|
|
48
42
|
handlexAxisOnlyValuesPresentChange: (xAxisOnlyValuesPresent: boolean) => void;
|
|
49
|
-
renderXAxis():
|
|
50
|
-
renderColorAxis(): React.
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
renderStacked(): React.DetailedReactHTMLElement<React.HTMLAttributes<HTMLElement>, HTMLElement> | null;
|
|
59
|
-
renderColor(): React.DetailedReactHTMLElement<{
|
|
60
|
-
className: string;
|
|
61
|
-
}, HTMLElement> | undefined;
|
|
62
|
-
renderFilter(): React.DetailedReactHTMLElement<{
|
|
63
|
-
className: string;
|
|
64
|
-
}, HTMLElement> | null;
|
|
65
|
-
render(): React.DetailedReactHTMLElement<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
43
|
+
renderXAxis(): React.ReactNode[] | undefined;
|
|
44
|
+
renderColorAxis(): React.JSX.Element | undefined;
|
|
45
|
+
renderYAxis(): React.JSX.Element | undefined;
|
|
46
|
+
renderCumulative(): React.JSX.Element | undefined;
|
|
47
|
+
renderTrendline(): React.JSX.Element | undefined;
|
|
48
|
+
renderStacked(): React.JSX.Element | undefined;
|
|
49
|
+
renderColor(): React.JSX.Element | undefined;
|
|
50
|
+
renderFilter(): React.JSX.Element | undefined;
|
|
51
|
+
render(): React.JSX.Element;
|
|
66
52
|
}
|
|
@@ -26,9 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
const lodash_1 = __importDefault(require("lodash"));
|
|
30
29
|
const react_1 = __importDefault(require("react"));
|
|
31
|
-
const R = react_1.default.createElement;
|
|
32
30
|
const AxisComponent_1 = __importDefault(require("../../../axes/AxisComponent"));
|
|
33
31
|
const AxisBuilder_1 = __importDefault(require("../../../axes/AxisBuilder"));
|
|
34
32
|
const expressions_ui_1 = require("@mwater/expressions-ui");
|
|
@@ -53,18 +51,22 @@ class LayeredChartLayerDesignerComponent extends react_1.default.Component {
|
|
|
53
51
|
return !this.isLayerPolar(layer);
|
|
54
52
|
}
|
|
55
53
|
getAxisTypes(layer, axisKey) {
|
|
56
|
-
|
|
54
|
+
const types = LayeredChartUtils.getAxisTypes(this.props.design, layer, axisKey);
|
|
55
|
+
return types ?? undefined;
|
|
57
56
|
}
|
|
58
57
|
getAxisLabel(icon, label) {
|
|
59
|
-
return
|
|
58
|
+
return react_1.default.createElement("span", null,
|
|
59
|
+
react_1.default.createElement("i", { className: `fas fa-${icon}` }),
|
|
60
|
+
" ",
|
|
61
|
+
label);
|
|
60
62
|
}
|
|
61
63
|
// Determine icon/label for color axis
|
|
62
64
|
getXAxisLabel(layer) {
|
|
63
65
|
if (this.props.design.transpose) {
|
|
64
|
-
return this.getAxisLabel("
|
|
66
|
+
return this.getAxisLabel("arrows-v", T `Vertical Axis`);
|
|
65
67
|
}
|
|
66
68
|
else {
|
|
67
|
-
return this.getAxisLabel("
|
|
69
|
+
return this.getAxisLabel("arrows-h", T `Horizontal Axis`);
|
|
68
70
|
}
|
|
69
71
|
}
|
|
70
72
|
// Determine icon/label for color axis
|
|
@@ -73,10 +75,10 @@ class LayeredChartLayerDesignerComponent extends react_1.default.Component {
|
|
|
73
75
|
return this.getAxisLabel("repeat", T `Angle Axis`);
|
|
74
76
|
}
|
|
75
77
|
else if (this.props.design.transpose) {
|
|
76
|
-
return this.getAxisLabel("
|
|
78
|
+
return this.getAxisLabel("arrows-h", T `Horizontal Axis`);
|
|
77
79
|
}
|
|
78
80
|
else {
|
|
79
|
-
return this.getAxisLabel("
|
|
81
|
+
return this.getAxisLabel("arrows-v", T `Vertical Axis`);
|
|
80
82
|
}
|
|
81
83
|
}
|
|
82
84
|
// Determine icon/label for color axis
|
|
@@ -90,17 +92,20 @@ class LayeredChartLayerDesignerComponent extends react_1.default.Component {
|
|
|
90
92
|
}
|
|
91
93
|
// Updates layer with the specified changes
|
|
92
94
|
updateLayer(changes) {
|
|
93
|
-
const layer =
|
|
95
|
+
const layer = { ...this.props.design.layers[this.props.index], ...changes };
|
|
94
96
|
return this.props.onChange(layer);
|
|
95
97
|
}
|
|
96
98
|
// Update axes with specified changes
|
|
97
99
|
updateAxes(changes) {
|
|
98
|
-
const axes =
|
|
100
|
+
const axes = { ...this.props.design.layers[this.props.index].axes, ...changes };
|
|
99
101
|
return this.updateLayer({ axes });
|
|
100
102
|
}
|
|
101
103
|
handleNameChange = (ev) => {
|
|
102
104
|
return this.updateLayer({ name: ev.target.value });
|
|
103
105
|
};
|
|
106
|
+
handleLayerTypeChange = (type) => {
|
|
107
|
+
this.updateLayer({ type: type === this.props.design.type ? undefined : type });
|
|
108
|
+
};
|
|
104
109
|
handleTableChange = (table) => {
|
|
105
110
|
return this.updateLayer({ table });
|
|
106
111
|
};
|
|
@@ -114,7 +119,6 @@ class LayeredChartLayerDesignerComponent extends react_1.default.Component {
|
|
|
114
119
|
return this.updateAxes(axesChanges);
|
|
115
120
|
};
|
|
116
121
|
handleXColorMapChange = (xColorMap) => {
|
|
117
|
-
const layer = this.props.design.layers[this.props.index];
|
|
118
122
|
return this.updateLayer({ xColorMap });
|
|
119
123
|
};
|
|
120
124
|
handleColorAxisChange = (axis) => {
|
|
@@ -146,32 +150,57 @@ class LayeredChartLayerDesignerComponent extends react_1.default.Component {
|
|
|
146
150
|
};
|
|
147
151
|
renderName() {
|
|
148
152
|
const layer = this.props.design.layers[this.props.index];
|
|
149
|
-
// R 'div', className: "form-group",
|
|
150
|
-
// R 'label', className: "text-muted", "Series Name"
|
|
151
153
|
const placeholder = this.props.design.layers.length === 1 ? T `Value` : T `Series ${this.props.index + 1}`;
|
|
152
|
-
return
|
|
153
|
-
type: "text",
|
|
154
|
-
className: "form-control form-control-sm",
|
|
155
|
-
value: layer.name,
|
|
156
|
-
onChange: this.handleNameChange,
|
|
157
|
-
placeholder
|
|
158
|
-
});
|
|
154
|
+
return react_1.default.createElement("input", { type: "text", className: "form-control form-control-sm", value: layer.name, onChange: this.handleNameChange, placeholder: placeholder });
|
|
159
155
|
}
|
|
160
156
|
renderRemove() {
|
|
161
157
|
if (this.props.design.layers.length > 1) {
|
|
162
|
-
return
|
|
158
|
+
return (react_1.default.createElement("button", { className: "btn btn-sm btn-link float-end", type: "button", onClick: this.props.onRemove },
|
|
159
|
+
react_1.default.createElement("span", { className: "fas fa-times" })));
|
|
163
160
|
}
|
|
164
|
-
return
|
|
161
|
+
return undefined;
|
|
165
162
|
}
|
|
166
163
|
renderTable() {
|
|
167
164
|
const layer = this.props.design.layers[this.props.index];
|
|
168
|
-
return
|
|
169
|
-
schema: this.props.schema,
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
165
|
+
return (react_1.default.createElement(uiComponents.SectionComponent, { icon: "fa-database", label: T `Data Source` },
|
|
166
|
+
react_1.default.createElement(expressions_ui_2.TableSelectComponent, { schema: this.props.schema, value: layer.table, onChange: this.handleTableChange, filter: layer.filter, onFilterChange: this.handleFilterChange })));
|
|
167
|
+
}
|
|
168
|
+
renderLayerTypeSelector() {
|
|
169
|
+
const layer = this.props.design.layers[this.props.index];
|
|
170
|
+
const { design, index } = this.props;
|
|
171
|
+
if (index === 0) {
|
|
172
|
+
return null;
|
|
173
|
+
}
|
|
174
|
+
const mainType = design.type;
|
|
175
|
+
const isMainPolar = ["pie", "donut"].includes(mainType);
|
|
176
|
+
const compatibleTypes = isMainPolar
|
|
177
|
+
? [
|
|
178
|
+
{ value: "pie", label: T `Pie` },
|
|
179
|
+
{ value: "donut", label: T `Donut` }
|
|
180
|
+
]
|
|
181
|
+
: [
|
|
182
|
+
{ value: "bar", label: T `Bar` },
|
|
183
|
+
{ value: "line", label: T `Line` },
|
|
184
|
+
{ value: "spline", label: T `Smoothed Line` },
|
|
185
|
+
{ value: "area", label: T `Area` }
|
|
186
|
+
];
|
|
187
|
+
// Add the main type as the first option if it's not already there (e.g. if main is scatter)
|
|
188
|
+
if (!compatibleTypes.some((t) => t.value === mainType)) {
|
|
189
|
+
compatibleTypes.unshift({ value: mainType, label: T(mainType) });
|
|
190
|
+
}
|
|
191
|
+
// Assign names for OptionListComponent
|
|
192
|
+
compatibleTypes.forEach((t) => (t.name = t.label));
|
|
193
|
+
const currentType = layer.type || mainType;
|
|
194
|
+
const currentTypeLabel = compatibleTypes.find((t) => t.value === currentType)?.label || T(currentType);
|
|
195
|
+
return (react_1.default.createElement("div", { className: "mb-3" },
|
|
196
|
+
react_1.default.createElement("label", { className: "text-muted" }, T `Layer Chart Type`),
|
|
197
|
+
react_1.default.createElement(uiComponents.ToggleEditComponent, { label: currentTypeLabel, editor: (onClose) => (react_1.default.createElement(uiComponents.OptionListComponent, { hint: T `Select a Chart Type`, items: compatibleTypes.map((ct) => ({
|
|
198
|
+
name: ct.name || "",
|
|
199
|
+
onClick: () => {
|
|
200
|
+
onClose(); // Close editor first
|
|
201
|
+
return this.handleLayerTypeChange(ct.value);
|
|
202
|
+
}
|
|
203
|
+
})) })) })));
|
|
175
204
|
}
|
|
176
205
|
handlexAxisOnlyValuesPresentChange = (xAxisOnlyValuesPresent) => {
|
|
177
206
|
this.updateLayer({ xAxisOnlyValuesPresent });
|
|
@@ -179,13 +208,13 @@ class LayeredChartLayerDesignerComponent extends react_1.default.Component {
|
|
|
179
208
|
renderXAxis() {
|
|
180
209
|
const layer = this.props.design.layers[this.props.index];
|
|
181
210
|
if (!layer.table) {
|
|
182
|
-
return;
|
|
211
|
+
return undefined;
|
|
183
212
|
}
|
|
184
213
|
if (!this.isXAxisRequired(layer)) {
|
|
185
|
-
return;
|
|
214
|
+
return undefined;
|
|
186
215
|
}
|
|
187
216
|
const title = this.getXAxisLabel(layer);
|
|
188
|
-
const filters =
|
|
217
|
+
const filters = this.props.filters ? this.props.filters.slice() : [];
|
|
189
218
|
if (layer.filter != null) {
|
|
190
219
|
const exprCompiler = new expressions_1.ExprCompiler(this.props.schema);
|
|
191
220
|
const jsonql = exprCompiler.compileExpr({ expr: layer.filter, tableAlias: "{alias}" });
|
|
@@ -195,67 +224,38 @@ class LayeredChartLayerDesignerComponent extends react_1.default.Component {
|
|
|
195
224
|
}
|
|
196
225
|
const categoricalX = new LayeredChartCompiler_1.default({ schema: this.props.schema }).isCategoricalX(this.props.design);
|
|
197
226
|
return [
|
|
198
|
-
|
|
199
|
-
schema: this.props.schema,
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
required: true,
|
|
205
|
-
value: layer.axes.x,
|
|
206
|
-
onChange: this.handleXAxisChange,
|
|
207
|
-
filters,
|
|
208
|
-
// Only show x color map if no color axis and is categorical and enabled
|
|
209
|
-
showColorMap: layer.xColorMap && categoricalX && !layer.axes.color,
|
|
210
|
-
autosetColors: false,
|
|
211
|
-
// Categorical X can exclude values
|
|
212
|
-
allowExcludedValues: categoricalX
|
|
213
|
-
})),
|
|
214
|
-
categoricalX ? R(ui.Checkbox, {
|
|
215
|
-
value: layer.xAxisOnlyValuesPresent,
|
|
216
|
-
onChange: this.handlexAxisOnlyValuesPresentChange
|
|
217
|
-
}, T `Only show values actually present `, R(PopoverHelpComponent_1.default, { placement: 'bottom' }, T `Limits values to those that are present in the data, as opposed to all choices or all dates within range`)) : null,
|
|
218
|
-
react_1.default.createElement("br", null)
|
|
227
|
+
react_1.default.createElement(uiComponents.SectionComponent, { key: "axis", label: title },
|
|
228
|
+
react_1.default.createElement(AxisComponent_1.default, { schema: this.props.schema, dataSource: this.props.dataSource, table: layer.table, types: this.getAxisTypes(layer, "x"), aggrNeed: "none", required: true, value: layer.axes.x, onChange: this.handleXAxisChange, filters: filters, showColorMap: layer.xColorMap && categoricalX && !layer.axes.color, autosetColors: false, allowExcludedValues: categoricalX })),
|
|
229
|
+
categoricalX ? (react_1.default.createElement(ui.Checkbox, { key: "checkbox", value: layer.xAxisOnlyValuesPresent, onChange: this.handlexAxisOnlyValuesPresentChange },
|
|
230
|
+
T `Only show values actually present `,
|
|
231
|
+
react_1.default.createElement(PopoverHelpComponent_1.default, { placement: "bottom" }, T `Limits values to those that are present in the data, as opposed to all choices or all dates within range`))) : undefined,
|
|
232
|
+
react_1.default.createElement("br", { key: "br" })
|
|
219
233
|
];
|
|
220
234
|
}
|
|
221
235
|
renderColorAxis() {
|
|
222
236
|
const layer = this.props.design.layers[this.props.index];
|
|
223
237
|
if (!layer.table) {
|
|
224
|
-
return;
|
|
238
|
+
return undefined;
|
|
225
239
|
}
|
|
226
240
|
const title = this.getColorAxisLabel(layer);
|
|
227
|
-
return
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
types: this.getAxisTypes(layer, "color"),
|
|
232
|
-
aggrNeed: "none",
|
|
233
|
-
required: this.isLayerPolar(layer),
|
|
234
|
-
showColorMap: true,
|
|
235
|
-
value: layer.axes.color,
|
|
236
|
-
onChange: this.handleColorAxisChange,
|
|
237
|
-
allowExcludedValues: true,
|
|
238
|
-
filters: this.props.filters
|
|
239
|
-
})));
|
|
241
|
+
return (react_1.default.createElement("div", { className: "mb-3" },
|
|
242
|
+
react_1.default.createElement("label", { className: "text-muted" }, title),
|
|
243
|
+
react_1.default.createElement("div", { style: { marginLeft: 10 } },
|
|
244
|
+
react_1.default.createElement(AxisComponent_1.default, { schema: this.props.schema, dataSource: this.props.dataSource, table: layer.table, types: this.getAxisTypes(layer, "color"), aggrNeed: "none", required: this.isLayerPolar(layer), showColorMap: true, value: layer.axes.color, onChange: this.handleColorAxisChange, allowExcludedValues: true, filters: this.props.filters }))));
|
|
240
245
|
}
|
|
241
246
|
renderYAxis() {
|
|
242
247
|
const layer = this.props.design.layers[this.props.index];
|
|
243
248
|
if (!layer.table) {
|
|
244
|
-
return;
|
|
249
|
+
return undefined;
|
|
245
250
|
}
|
|
246
251
|
const title = this.getYAxisLabel(layer);
|
|
247
|
-
return
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
required: true,
|
|
255
|
-
filters: this.props.filters,
|
|
256
|
-
showFormat: true,
|
|
257
|
-
onChange: this.handleYAxisChange
|
|
258
|
-
}), this.renderCumulative(), this.renderStacked(), this.renderTrendline()));
|
|
252
|
+
return (react_1.default.createElement("div", { className: "mb-3" },
|
|
253
|
+
react_1.default.createElement("label", { className: "text-muted" }, title),
|
|
254
|
+
react_1.default.createElement("div", { style: { marginLeft: 10 } },
|
|
255
|
+
react_1.default.createElement(AxisComponent_1.default, { schema: this.props.schema, dataSource: this.props.dataSource, table: layer.table, types: this.getAxisTypes(layer, "y"), aggrNeed: this.doesLayerNeedGrouping(layer) ? "required" : "none", value: layer.axes.y, required: true, filters: this.props.filters, showFormat: true, onChange: this.handleYAxisChange }),
|
|
256
|
+
this.renderCumulative(),
|
|
257
|
+
this.renderStacked(),
|
|
258
|
+
this.renderTrendline())));
|
|
259
259
|
}
|
|
260
260
|
renderCumulative() {
|
|
261
261
|
const layer = this.props.design.layers[this.props.index];
|
|
@@ -264,7 +264,8 @@ class LayeredChartLayerDesignerComponent extends react_1.default.Component {
|
|
|
264
264
|
if (!layer.axes.y || !layer.axes.x || !axisBuilder.doesAxisSupportCumulative(layer.axes.x)) {
|
|
265
265
|
return;
|
|
266
266
|
}
|
|
267
|
-
return
|
|
267
|
+
return (react_1.default.createElement("div", { key: "cumulative" },
|
|
268
|
+
react_1.default.createElement(bootstrap_1.Checkbox, { inline: true, value: layer.cumulative, onChange: this.handleCumulativeChange }, T `Cumulative`)));
|
|
268
269
|
}
|
|
269
270
|
renderTrendline() {
|
|
270
271
|
const layer = this.props.design.layers[this.props.index];
|
|
@@ -273,58 +274,60 @@ class LayeredChartLayerDesignerComponent extends react_1.default.Component {
|
|
|
273
274
|
if (!layer.axes.y || !layer.axes.x || layer.cumulative || layer.stacked || this.props.design.stacked) {
|
|
274
275
|
return;
|
|
275
276
|
}
|
|
276
|
-
return
|
|
277
|
+
return (react_1.default.createElement("div", { key: "trendline" },
|
|
278
|
+
react_1.default.createElement(bootstrap_1.Checkbox, { value: layer.trendline === "linear", onChange: this.handleTrendlineChange }, T `Show linear trendline`)));
|
|
277
279
|
}
|
|
278
280
|
renderStacked() {
|
|
279
281
|
const layer = this.props.design.layers[this.props.index];
|
|
280
282
|
// Only if has color axis and there are more than one layer
|
|
281
283
|
if (layer.axes.color && this.props.design.layers.length > 1) {
|
|
282
284
|
const stacked = layer.stacked != null ? layer.stacked : true;
|
|
283
|
-
return
|
|
285
|
+
return (react_1.default.createElement("div", { key: "stacked" },
|
|
286
|
+
react_1.default.createElement(bootstrap_1.Checkbox, { value: stacked, onChange: this.handleStackedChange }, T `Stacked`)));
|
|
284
287
|
}
|
|
285
|
-
return
|
|
288
|
+
return undefined;
|
|
286
289
|
}
|
|
287
290
|
renderColor() {
|
|
288
291
|
const layer = this.props.design.layers[this.props.index];
|
|
289
292
|
// If not table do nothing
|
|
290
293
|
if (!layer.table) {
|
|
291
|
-
return;
|
|
294
|
+
return undefined;
|
|
292
295
|
}
|
|
293
296
|
const categoricalX = new LayeredChartCompiler_1.default({ schema: this.props.schema }).isCategoricalX(this.props.design);
|
|
294
|
-
return
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
297
|
+
return (react_1.default.createElement("div", { className: "mb-3" },
|
|
298
|
+
react_1.default.createElement("label", { className: "text-muted" }, layer.axes.color ? T `Default Color` : T `Color`),
|
|
299
|
+
react_1.default.createElement("div", { style: { marginLeft: 8 } },
|
|
300
|
+
react_1.default.createElement(ColorComponent_1.default, { color: layer.color, onChange: this.handleColorChange }),
|
|
301
|
+
layer.axes.x && categoricalX && !layer.axes.color ? (react_1.default.createElement(ui.Checkbox, { value: layer.xColorMap, onChange: this.handleXColorMapChange }, T `Set Individual Colors`)) : undefined)));
|
|
299
302
|
}
|
|
300
303
|
renderFilter() {
|
|
301
304
|
const layer = this.props.design.layers[this.props.index];
|
|
302
305
|
// If no table, hide
|
|
303
306
|
if (!layer.table) {
|
|
304
|
-
return
|
|
307
|
+
return undefined;
|
|
305
308
|
}
|
|
306
|
-
return
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
309
|
+
return (react_1.default.createElement("div", { className: "mb-3" },
|
|
310
|
+
react_1.default.createElement("label", { className: "text-muted" },
|
|
311
|
+
react_1.default.createElement("span", { className: "fas fa-filter" }),
|
|
312
|
+
" ",
|
|
313
|
+
T `Filters`),
|
|
314
|
+
react_1.default.createElement("div", { style: { marginLeft: 8 } },
|
|
315
|
+
react_1.default.createElement(expressions_ui_1.FilterExprComponent, { schema: this.props.schema, dataSource: this.props.dataSource, onChange: this.handleFilterChange, table: layer.table, value: layer.filter }))));
|
|
313
316
|
}
|
|
314
317
|
render() {
|
|
315
318
|
const layer = this.props.design.layers[this.props.index];
|
|
316
|
-
return
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
319
|
+
return (react_1.default.createElement("div", null,
|
|
320
|
+
this.props.index > 0 ? react_1.default.createElement("hr", null) : undefined,
|
|
321
|
+
this.renderRemove(),
|
|
322
|
+
this.renderTable(),
|
|
323
|
+
this.renderLayerTypeSelector(),
|
|
324
|
+
this.isLayerPolar(layer) ? this.renderColorAxis() : undefined,
|
|
325
|
+
this.renderXAxis(),
|
|
326
|
+
layer.axes.x || layer.axes.color ? this.renderYAxis() : undefined,
|
|
327
|
+
layer.axes.x && layer.axes.y && !this.isLayerPolar(layer) ? this.renderColorAxis() : undefined,
|
|
328
|
+
!this.isLayerPolar(layer) && layer.axes.y ? this.renderColor() : undefined,
|
|
329
|
+
layer.axes.y ? this.renderFilter() : undefined,
|
|
330
|
+
layer.axes.y ? this.renderName() : undefined));
|
|
328
331
|
}
|
|
329
332
|
}
|
|
330
333
|
exports.default = LayeredChartLayerDesignerComponent;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { LiteralType } from "@mwater/expressions";
|
|
2
|
+
export declare function getAxisTypes(design: any, layer: any, axis: any): LiteralType[] | null;
|
|
@@ -40,4 +40,6 @@ export default class PivotChart extends Chart {
|
|
|
40
40
|
getFilterableTables(design: PivotChartDesign, schema: Schema): string[];
|
|
41
41
|
getPlaceholderIcon(): string;
|
|
42
42
|
translateDesign(design: PivotChartDesign, translate: (input: string) => string): PivotChartDesign;
|
|
43
|
+
supportsXlsxExport(): boolean;
|
|
44
|
+
createXlsxWorkbook(design: PivotChartDesign, schema: Schema, dataSource: DataSource, data: any, locale: string): any;
|
|
43
45
|
}
|