@mwater/visualization 5.1.0 → 5.3.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/ColorComponent.d.ts +10 -11
- package/lib/ColorComponent.js +78 -29
- package/lib/ColorSchemeFactory.d.ts +13 -2
- package/lib/ColorSchemeFactory.js +7 -5
- package/lib/CustomColorsContext.d.ts +6 -0
- package/lib/CustomColorsContext.js +6 -0
- package/lib/FiltersDesignerComponent.d.ts +1 -4
- package/lib/FiltersDesignerComponent.js +2 -3
- package/lib/GlobalFilter.d.ts +13 -0
- package/lib/GlobalFilter.js +2 -0
- package/lib/LocaleContextInjector.d.ts +5 -11
- package/lib/LocaleContextInjector.js +4 -12
- package/lib/MWaterAddRelatedFormComponent.js +3 -3
- package/lib/MWaterAddRelatedIndicatorComponent.d.ts +1 -4
- package/lib/MWaterAddRelatedIndicatorComponent.js +6 -6
- package/lib/MWaterCompleteTableSelectComponent.d.ts +7 -25
- package/lib/MWaterCompleteTableSelectComponent.js +36 -36
- package/lib/MWaterContextComponent.d.ts +19 -9
- package/lib/MWaterContextComponent.js +38 -22
- package/lib/MWaterCustomTablesetListComponent.js +9 -3
- package/lib/MWaterGlobalFiltersComponent.d.ts +6 -5
- package/lib/MWaterGlobalFiltersComponent.js +4 -4
- package/lib/MWaterLoaderComponent.d.ts +15 -3
- package/lib/MWaterLoaderComponent.js +11 -2
- package/lib/MWaterTableSelectComponent.d.ts +1 -4
- package/lib/MWaterTableSelectComponent.js +10 -12
- package/lib/UIComponents.d.ts +2 -2
- package/lib/UIComponents.js +4 -12
- package/lib/axes/Axis.d.ts +20 -25
- package/lib/axes/AxisBuilder.d.ts +7 -4
- package/lib/axes/AxisBuilder.js +12 -8
- package/lib/axes/AxisComponent.d.ts +6 -9
- package/lib/axes/AxisComponent.js +1 -2
- package/lib/axes/ColorPaletteCollectionComponent.d.ts +5 -12
- package/lib/axes/ColorPaletteCollectionComponent.js +67 -36
- package/lib/dashboards/DashboardComponent.d.ts +4 -17
- package/lib/dashboards/DashboardComponent.js +20 -67
- package/lib/dashboards/DashboardDesign.d.ts +5 -20
- package/lib/dashboards/DashboardUpgrader.js +36 -1
- package/lib/dashboards/DashboardViewComponent.d.ts +5 -34
- package/lib/dashboards/DashboardViewComponent.js +112 -136
- package/lib/dashboards/FontStyleEditor.d.ts +8 -0
- package/lib/dashboards/FontStyleEditor.js +130 -0
- package/lib/dashboards/LayoutOptionsComponent.d.ts +0 -1
- package/lib/dashboards/LayoutOptionsComponent.js +209 -39
- package/lib/dashboards/ServerDashboardDataSource.d.ts +1 -2
- package/lib/dashboards/ServerDashboardDataSource.js +52 -33
- package/lib/dashboards/SettingsModalComponent.d.ts +4 -15
- package/lib/dashboards/SettingsModalComponent.js +24 -38
- package/lib/dashboards/WidgetComponent.d.ts +3 -3
- package/lib/dashboards/WidgetComponent.js +3 -6
- package/lib/dashboards/WidgetDataSourcePrioritizer.d.ts +20 -0
- package/lib/dashboards/WidgetDataSourcePrioritizer.js +72 -0
- package/lib/dashboards/layoutOptions.d.ts +83 -0
- package/lib/dashboards/layoutOptions.js +436 -10
- package/lib/datagrids/DatagridComponent.d.ts +2 -9
- package/lib/datagrids/DatagridDataSource.d.ts +3 -3
- package/lib/datagrids/DatagridDataSource.js +0 -14
- package/lib/datagrids/DatagridDesign.d.ts +7 -6
- package/lib/datagrids/DatagridDesignerComponent.d.ts +2 -93
- package/lib/datagrids/DatagridDesignerComponent.js +8 -6
- package/lib/datagrids/DatagridViewComponent.js +1 -1
- package/lib/datagrids/FindReplaceModalComponent.d.ts +4 -20
- package/lib/datagrids/FindReplaceModalComponent.js +27 -13
- package/lib/datagrids/ServerDatagridDataSource.d.ts +8 -7
- package/lib/datagrids/ServerDatagridDataSource.js +88 -36
- package/lib/demo.js +4 -4
- package/lib/index.css +5 -0
- package/lib/index.d.ts +2 -1
- package/lib/index.js +0 -1
- package/lib/layouts/LayoutManager.d.ts +33 -29
- package/lib/layouts/LayoutManager.js +2 -8
- package/lib/layouts/blocks/BlocksDisplayComponent.d.ts +26 -56
- package/lib/layouts/blocks/BlocksDisplayComponent.js +122 -205
- package/lib/layouts/blocks/BlocksLayoutManager.d.ts +6 -22
- package/lib/layouts/blocks/BlocksLayoutManager.js +5 -14
- package/lib/layouts/blocks/HorizontalBlockComponent.d.ts +5 -4
- package/lib/layouts/blocks/HorizontalBlockComponent.js +5 -5
- package/lib/layouts/grid/GridLayoutManager.d.ts +2 -1
- package/lib/mWaterLoader.d.ts +2 -0
- package/lib/mWaterLoader.js +2 -1
- package/lib/maps/AddLayerComponent.d.ts +6 -8
- package/lib/maps/AddLayerComponent.js +6 -6
- package/lib/maps/BingLayer.js +10 -20
- package/lib/maps/BufferLayer.js +5 -2
- package/lib/maps/ChoroplethLayer.js +2 -1
- package/lib/maps/ClusterLayer.js +3 -1
- package/lib/maps/DirectMapDataSource.d.ts +5 -2
- package/lib/maps/DirectMapDataSource.js +2 -1
- package/lib/maps/EditPopupComponent.js +2 -1
- package/lib/maps/GridLayer.js +5 -3
- package/lib/maps/GridLayerDesigner.js +0 -1
- package/lib/maps/LayerSwitcherComponent.js +1 -1
- package/lib/maps/MapComponent.d.ts +3 -11
- package/lib/maps/MapComponent.js +3 -3
- package/lib/maps/MapDesign.d.ts +2 -13
- package/lib/maps/MapFiltersDesignerComponent.d.ts +0 -4
- package/lib/maps/MapFiltersDesignerComponent.js +4 -5
- package/lib/maps/MarkersLayer.js +30 -25
- package/lib/maps/RasterMapViewComponent.d.ts +3 -13
- package/lib/maps/RasterMapViewComponent.js +3 -3
- package/lib/maps/RegionSelectComponent.d.ts +2 -1
- package/lib/maps/ServerMapDataSource.d.ts +3 -4
- package/lib/maps/ServerMapDataSource.js +5 -5
- package/lib/maps/VectorMapViewComponent.js +2 -1
- package/lib/maps/mapSymbols.js +2 -0
- package/lib/maps/symbols/font-awesome/cloud-rain.png +0 -0
- package/lib/maps/vectorMaps.d.ts +1 -0
- package/lib/maps/vectorMaps.js +70 -56
- package/lib/quickfilter/QuickfilterCompiler.d.ts +1 -1
- package/lib/quickfilter/QuickfiltersComponent.d.ts +1 -4
- package/lib/quickfilter/QuickfiltersComponent.js +3 -3
- package/lib/richtext/DropdownPaletteItem.d.ts +32 -0
- package/lib/richtext/DropdownPaletteItem.js +82 -0
- package/lib/richtext/FontColorPaletteItem.d.ts +1 -5
- package/lib/richtext/FontColorPaletteItem.js +32 -27
- package/lib/richtext/ItemsHtmlConverter.js +12 -3
- package/lib/richtext/RichTextComponent.d.ts +26 -52
- package/lib/richtext/RichTextComponent.js +166 -128
- package/lib/valueFormatter.js +6 -1
- package/lib/wellknown.d.ts +5 -0
- package/lib/wellknown.js +288 -0
- package/lib/widgets/DropdownWidgetComponent.d.ts +8 -25
- package/lib/widgets/DropdownWidgetComponent.js +48 -25
- package/lib/widgets/IFrameWidgetComponent.d.ts +3 -11
- package/lib/widgets/ImageWidgetComponent.d.ts +8 -27
- package/lib/widgets/MapWidget.d.ts +4 -7
- package/lib/widgets/MapWidget.js +2 -1
- package/lib/widgets/MarkdownWidget.d.ts +2 -7
- package/lib/widgets/TOCWidget.d.ts +2 -9
- package/lib/widgets/TOCWidget.js +2 -1
- package/lib/widgets/Widget.d.ts +2 -0
- package/lib/widgets/WidgetDataSource.d.ts +3 -1
- package/lib/widgets/charts/Chart.d.ts +0 -1
- package/lib/widgets/charts/ChartViewComponent.d.ts +4 -0
- package/lib/widgets/charts/ChartViewComponent.js +11 -3
- package/lib/widgets/charts/ChartWidget.d.ts +1 -74
- package/lib/widgets/charts/ChartWidget.js +4 -183
- package/lib/widgets/charts/ChartWidgetComponent.d.ts +51 -0
- package/lib/widgets/charts/ChartWidgetComponent.js +167 -0
- package/lib/widgets/charts/calendar/CalendarChartViewComponent.d.ts +1 -4
- package/lib/widgets/charts/calendar/CalendarChartViewComponent.js +4 -4
- package/lib/widgets/charts/imagemosaic/ImagePopupComponent.d.ts +2 -7
- package/lib/widgets/charts/layered/LayeredChart.d.ts +5 -10
- package/lib/widgets/charts/layered/LayeredChart.js +6 -7
- package/lib/widgets/charts/layered/LayeredChartCompiler.d.ts +4 -2
- package/lib/widgets/charts/layered/LayeredChartCompiler.js +46 -32
- package/lib/widgets/charts/layered/LayeredChartDesign.d.ts +4 -0
- package/lib/widgets/charts/layered/LayeredChartDesignerComponent.d.ts +5 -31
- package/lib/widgets/charts/layered/LayeredChartDesignerComponent.js +21 -3
- package/lib/widgets/charts/layered/LayeredChartLayerDesignerComponent.d.ts +1 -7
- package/lib/widgets/charts/layered/LayeredChartLayerDesignerComponent.js +2 -1
- package/lib/widgets/charts/layered/LayeredChartViewComponent.d.ts +1 -4
- package/lib/widgets/charts/layered/LayeredChartViewComponent.js +89 -38
- package/lib/widgets/charts/pivot/IntersectionDesignerComponent.d.ts +5 -105
- package/lib/widgets/charts/pivot/IntersectionDesignerComponent.js +122 -166
- package/lib/widgets/charts/pivot/PivotChart.d.ts +6 -0
- package/lib/widgets/charts/pivot/PivotChart.js +47 -17
- package/lib/widgets/charts/pivot/PivotChartDesign.d.ts +11 -0
- package/lib/widgets/charts/pivot/PivotChartDesignerComponent.d.ts +11 -7
- package/lib/widgets/charts/pivot/PivotChartDesignerComponent.js +1 -1
- package/lib/widgets/charts/pivot/PivotChartLayoutBuilder.d.ts +2 -2
- package/lib/widgets/charts/pivot/PivotChartLayoutBuilder.js +20 -36
- package/lib/widgets/charts/pivot/PivotChartLayoutComponent.js +0 -1
- package/lib/widgets/charts/pivot/PivotChartQueryBuilder.d.ts +23 -2
- package/lib/widgets/charts/pivot/PivotChartQueryBuilder.js +215 -181
- package/lib/widgets/charts/pivot/PivotChartUtils.d.ts +2 -2
- package/lib/widgets/charts/pivot/PivotChartViewComponent.d.ts +9 -47
- package/lib/widgets/charts/pivot/PivotChartViewComponent.js +20 -60
- package/lib/widgets/charts/pivot/SegmentDesignerComponent.d.ts +55 -58
- package/lib/widgets/charts/table/TableChart.js +8 -4
- package/lib/widgets/charts/table/TableChartDesignerComponent.js +3 -3
- package/lib/widgets/charts/table/TableChartViewComponent.js +30 -16
- package/lib/widgets/text/ExprInsertModalComponent.d.ts +2 -13
- package/lib/widgets/text/ExprUpdateModalComponent.d.ts +2 -13
- package/lib/widgets/text/TextComponent.d.ts +5 -12
- package/lib/widgets/text/TextComponent.js +19 -39
- package/lib/widgets/text/TextWidget.d.ts +2 -1
- package/lib/widgets/text/TextWidget.js +5 -1
- package/lib/widgets/text/TextWidgetComponent.d.ts +15 -3
- package/lib/widgets/text/TextWidgetComponent.js +76 -19
- package/lib/widgets/text/TextWidgetDesign.d.ts +16 -2
- package/lib/widgets/text/TextWidgetDesign.js +6 -0
- package/package.json +4 -4
- package/src/ColorComponent.tsx +177 -0
- package/src/ColorSchemeFactory.ts +12 -6
- package/src/CustomColorsContext.tsx +8 -0
- package/src/FiltersDesignerComponent.ts +3 -4
- package/src/GlobalFilter.ts +17 -0
- package/src/LocaleContextInjector.tsx +14 -13
- package/src/MWaterAddRelatedFormComponent.ts +3 -3
- package/src/MWaterAddRelatedIndicatorComponent.ts +6 -6
- package/src/MWaterCompleteTableSelectComponent.tsx +36 -36
- package/src/MWaterContextComponent.tsx +42 -33
- package/src/MWaterCustomTablesetListComponent.tsx +21 -3
- package/src/MWaterGlobalFiltersComponent.ts +8 -8
- package/src/MWaterLoaderComponent.ts +14 -4
- package/src/MWaterTableSelectComponent.tsx +11 -12
- package/src/{UIComponents.ts → UIComponents.tsx} +7 -15
- package/src/axes/Axis.ts +24 -25
- package/src/axes/AxisBuilder.ts +16 -13
- package/src/axes/AxisComponent.ts +3 -4
- package/src/axes/{ColorPaletteCollectionComponent.ts → ColorPaletteCollectionComponent.tsx} +87 -61
- package/src/dashboards/DashboardComponent.tsx +73 -147
- package/src/dashboards/DashboardDesign.ts +5 -25
- package/src/dashboards/DashboardUpgrader.ts +41 -1
- package/src/dashboards/DashboardViewComponent.tsx +313 -0
- package/src/dashboards/FontStyleEditor.tsx +166 -0
- package/src/dashboards/LayoutOptionsComponent.tsx +377 -71
- package/src/dashboards/ServerDashboardDataSource.ts +52 -33
- package/src/dashboards/SettingsModalComponent.tsx +170 -0
- package/src/dashboards/WidgetComponent.tsx +6 -12
- package/src/dashboards/WidgetDataSourcePrioritizer.ts +82 -0
- package/src/dashboards/layoutOptions.tsx +581 -0
- package/src/datagrids/DatagridDataSource.ts +6 -12
- package/src/datagrids/DatagridDesign.ts +8 -3
- package/src/datagrids/DatagridDesignerComponent.tsx +22 -18
- package/src/datagrids/DatagridViewComponent.ts +3 -3
- package/src/datagrids/ExprCellComponent.ts +0 -1
- package/src/datagrids/FindReplaceModalComponent.ts +39 -22
- package/src/datagrids/ServerDatagridDataSource.ts +107 -45
- package/src/demo.ts +4 -4
- package/src/index.css +5 -0
- package/src/index.ts +2 -1
- package/src/layouts/LayoutManager.ts +44 -42
- package/src/layouts/blocks/BlocksDisplayComponent.tsx +498 -0
- package/src/layouts/blocks/BlocksLayoutManager.ts +6 -15
- package/src/layouts/blocks/HorizontalBlockComponent.ts +9 -8
- package/src/mWaterLoader.ts +4 -1
- package/src/maps/AddLayerComponent.ts +9 -9
- package/src/maps/BingLayer.ts +16 -26
- package/src/maps/BufferLayer.ts +5 -2
- package/src/maps/ChoroplethLayer.ts +2 -1
- package/src/maps/ClusterLayer.ts +3 -1
- package/src/maps/DirectMapDataSource.ts +12 -3
- package/src/maps/EditPopupComponent.ts +2 -1
- package/src/maps/GridLayer.ts +5 -3
- package/src/maps/GridLayerDesigner.tsx +0 -1
- package/src/maps/LayerSwitcherComponent.tsx +1 -1
- package/src/maps/MapComponent.ts +3 -3
- package/src/maps/MapDesign.ts +2 -17
- package/src/maps/{MapFiltersDesignerComponent.ts → MapFiltersDesignerComponent.tsx} +25 -25
- package/src/maps/MarkersLayer.ts +38 -41
- package/src/maps/RasterMapViewComponent.ts +3 -3
- package/src/maps/ServerMapDataSource.ts +8 -8
- package/src/maps/VectorMapViewComponent.tsx +2 -2
- package/src/maps/mapSymbols.ts +2 -0
- package/src/maps/symbols/font-awesome/cloud-rain.png +0 -0
- package/src/maps/vectorMaps.tsx +88 -74
- package/src/quickfilter/QuickfilterCompiler.ts +1 -1
- package/src/quickfilter/QuickfiltersComponent.ts +3 -3
- package/src/richtext/DropdownPaletteItem.tsx +144 -0
- package/src/richtext/FontColorPaletteItem.tsx +160 -0
- package/src/richtext/ItemsHtmlConverter.ts +15 -5
- package/src/richtext/RichTextComponent.tsx +274 -232
- package/src/valueFormatter.ts +5 -1
- package/src/wellknown.ts +286 -0
- package/src/widgets/DropdownWidgetComponent.tsx +75 -0
- package/src/widgets/MapWidget.ts +5 -2
- package/src/widgets/TOCWidget.ts +2 -1
- package/src/widgets/Widget.ts +3 -0
- package/src/widgets/WidgetDataSource.ts +3 -1
- package/src/widgets/charts/Chart.ts +1 -1
- package/src/widgets/charts/ChartViewComponent.ts +16 -3
- package/src/widgets/charts/ChartWidget.ts +3 -275
- package/src/widgets/charts/ChartWidgetComponent.tsx +281 -0
- package/src/widgets/charts/calendar/CalendarChartViewComponent.tsx +4 -4
- package/src/widgets/charts/layered/LayeredChart.ts +4 -6
- package/src/widgets/charts/layered/LayeredChartCompiler.ts +80 -63
- package/src/widgets/charts/layered/LayeredChartDesign.ts +7 -1
- package/src/widgets/charts/layered/LayeredChartDesignerComponent.tsx +43 -10
- package/src/widgets/charts/layered/LayeredChartLayerDesignerComponent.tsx +6 -6
- package/src/widgets/charts/layered/LayeredChartViewComponent.ts +140 -88
- package/src/widgets/charts/pivot/IntersectionDesignerComponent.tsx +305 -221
- package/src/widgets/charts/pivot/PivotChart.ts +56 -18
- package/src/widgets/charts/pivot/PivotChartDesign.ts +12 -0
- package/src/widgets/charts/pivot/PivotChartDesignerComponent.tsx +4 -3
- package/src/widgets/charts/pivot/PivotChartLayoutBuilder.ts +39 -76
- package/src/widgets/charts/pivot/PivotChartLayoutComponent.tsx +0 -1
- package/src/widgets/charts/pivot/PivotChartQueryBuilder.ts +230 -189
- package/src/widgets/charts/pivot/PivotChartUtils.ts +4 -4
- package/src/widgets/charts/pivot/{PivotChartViewComponent.ts → PivotChartViewComponent.tsx} +86 -89
- package/src/widgets/charts/table/TableChart.ts +8 -4
- package/src/widgets/charts/table/TableChartDesignerComponent.ts +4 -4
- package/src/widgets/charts/table/TableChartViewComponent.ts +32 -19
- package/src/widgets/text/TextComponent.tsx +47 -49
- package/src/widgets/text/TextWidget.ts +8 -3
- package/src/widgets/text/TextWidgetComponent.tsx +249 -0
- package/src/widgets/text/TextWidgetDesign.ts +26 -2
- package/src/ColorComponent.ts +0 -117
- package/src/dashboards/DashboardViewComponent.ts +0 -304
- package/src/dashboards/SettingsModalComponent.ts +0 -169
- package/src/dashboards/layoutOptions.ts +0 -40
- package/src/layout-styles.css +0 -263
- package/src/layouts/blocks/BlocksDisplayComponent.ts +0 -461
- package/src/layouts/grid/GridLayoutComponent.ts +0 -67
- package/src/layouts/grid/GridLayoutManager.ts +0 -185
- package/src/layouts/grid/LegoLayoutEngine.ts +0 -142
- package/src/layouts/grid/PaletteItemComponent.ts +0 -28
- package/src/layouts/grid/README.md +0 -14
- package/src/layouts/grid/WidgetContainerComponent.ts +0 -420
- package/src/richtext/FontColorPaletteItem.ts +0 -172
- package/src/richtext/FontSizePaletteItem.ts +0 -110
- package/src/widgets/DropdownWidgetComponent.ts +0 -78
- package/src/widgets/text/TextWidgetComponent.ts +0 -120
|
@@ -18,17 +18,16 @@ const chartTypes = {
|
|
|
18
18
|
scatter,
|
|
19
19
|
area,
|
|
20
20
|
pie,
|
|
21
|
-
donut
|
|
21
|
+
donut
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
const commaFormatter = d3Format.format(",")
|
|
25
25
|
|
|
26
|
-
const compactFormatter = (d: number) => {
|
|
26
|
+
const compactFormatter = (d: number) => {
|
|
27
27
|
// Only if large, otherwise use standard formatting
|
|
28
28
|
if (Math.abs(d) > 999) {
|
|
29
|
-
return d3Format.format("~s")(d).replace(
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
29
|
+
return d3Format.format("~s")(d).replace("G", "B")
|
|
30
|
+
} else {
|
|
32
31
|
return commaFormatter(d)
|
|
33
32
|
}
|
|
34
33
|
}
|
|
@@ -39,17 +38,20 @@ type C3ChartData = { [key: string]: any[] }
|
|
|
39
38
|
/** Intermediate data structure that contains most of chart formatting */
|
|
40
39
|
interface C3Data {
|
|
41
40
|
types?: { [key: string]: ChartTypes }
|
|
42
|
-
|
|
41
|
+
|
|
43
42
|
columns: PrimitiveArray[]
|
|
44
43
|
|
|
45
44
|
xAxisType?: "category" | "indexed" | "log" | "timeseries"
|
|
46
45
|
|
|
47
46
|
xAxisTickFit?: boolean
|
|
48
47
|
|
|
48
|
+
/** Whether to allow multiline x axis tick labels (default true) */
|
|
49
|
+
xAxisTickMultiline?: boolean
|
|
50
|
+
|
|
49
51
|
xs?: { [key: string]: string }
|
|
50
|
-
|
|
52
|
+
|
|
51
53
|
/** map of "layername:index" to { layerIndex, row } */
|
|
52
|
-
dataMap: { [key: string]: { layerIndex: number
|
|
54
|
+
dataMap: { [key: string]: { layerIndex: number; row: any[] } }
|
|
53
55
|
|
|
54
56
|
format: { [layerId: string]: (value: any) => string }
|
|
55
57
|
|
|
@@ -62,14 +64,14 @@ interface C3Data {
|
|
|
62
64
|
legendHide?: boolean
|
|
63
65
|
|
|
64
66
|
/**
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
67
|
+
* Set custom data name.
|
|
68
|
+
*/
|
|
69
|
+
names?: { [key: string]: string }
|
|
68
70
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
groups?: string[][]
|
|
71
|
+
/**
|
|
72
|
+
* Set groups for the data for stacking.
|
|
73
|
+
*/
|
|
74
|
+
groups?: string[][]
|
|
73
75
|
|
|
74
76
|
/**
|
|
75
77
|
* Set label text colors.
|
|
@@ -80,11 +82,11 @@ interface C3Data {
|
|
|
80
82
|
|
|
81
83
|
color?: any
|
|
82
84
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
classes?: { [key: string]: string }
|
|
85
|
+
/**
|
|
86
|
+
* Set custom data class.
|
|
87
|
+
* If this option is specified, the element g for the data has an additional class that has the prefix billboard-target- (e.g. billboard-target-additional-data1-class).
|
|
88
|
+
*/
|
|
89
|
+
classes?: { [key: string]: string }
|
|
88
90
|
}
|
|
89
91
|
|
|
90
92
|
function pieLabelValueFormatter(format: any, hidePercent = false) {
|
|
@@ -144,7 +146,7 @@ export default class LayeredChartCompiler {
|
|
|
144
146
|
schema: Schema
|
|
145
147
|
exprUtils: ExprUtils
|
|
146
148
|
axisBuilder: AxisBuilder
|
|
147
|
-
|
|
149
|
+
|
|
148
150
|
// Pass in schema
|
|
149
151
|
constructor(options: { schema: Schema }) {
|
|
150
152
|
this.schema = options.schema
|
|
@@ -159,7 +161,7 @@ export default class LayeredChartCompiler {
|
|
|
159
161
|
createQueries(design: LayeredChartDesign, extraFilters?: JsonQLFilter[] | null): { [key: string]: JsonQLQuery } {
|
|
160
162
|
const exprCompiler = new ExprCompiler(this.schema)
|
|
161
163
|
|
|
162
|
-
const queries = {}
|
|
164
|
+
const queries: { [key: string]: JsonQLQuery } = {}
|
|
163
165
|
|
|
164
166
|
// For each layer
|
|
165
167
|
for (
|
|
@@ -305,7 +307,12 @@ export default class LayeredChartCompiler {
|
|
|
305
307
|
},
|
|
306
308
|
// Hide if one layer with no color axis
|
|
307
309
|
legend: {
|
|
308
|
-
hide:
|
|
310
|
+
hide:
|
|
311
|
+
options.design.layers.length === 1 && !options.design.layers[0].axes.color
|
|
312
|
+
? true
|
|
313
|
+
: options.design.hideLegend === true
|
|
314
|
+
? true
|
|
315
|
+
: c3Data.legendHide
|
|
309
316
|
},
|
|
310
317
|
grid: { focus: { show: false } }, // Don't display hover grid
|
|
311
318
|
axis: {
|
|
@@ -315,7 +322,12 @@ export default class LayeredChartCompiler {
|
|
|
315
322
|
text: cleanString(c3Data.xAxisLabelText),
|
|
316
323
|
position: options.design.transpose ? "outer-middle" : "outer-center"
|
|
317
324
|
},
|
|
318
|
-
tick: {
|
|
325
|
+
tick: {
|
|
326
|
+
multiline: options.design.xAxisTickMultiline,
|
|
327
|
+
culling: false,
|
|
328
|
+
fit: c3Data.xAxisTickFit
|
|
329
|
+
},
|
|
330
|
+
clipPath: false
|
|
319
331
|
},
|
|
320
332
|
y: {
|
|
321
333
|
label: {
|
|
@@ -358,29 +370,30 @@ export default class LayeredChartCompiler {
|
|
|
358
370
|
expand: false // Don't expand/contract
|
|
359
371
|
},
|
|
360
372
|
|
|
361
|
-
transition: { duration: 0 } // Transitions interfere with scoping
|
|
373
|
+
transition: { duration: 0 }, // Transitions interfere with scoping
|
|
374
|
+
// padding: !isPolar ? { mode: "fit" } : undefined
|
|
362
375
|
}
|
|
363
376
|
|
|
364
377
|
// && (options.design.type === "pie" || options.design.type === "donut")
|
|
365
|
-
if(options.design.labels) {
|
|
378
|
+
if (options.design.labels) {
|
|
366
379
|
// same color values gets hidden!! https://github.com/naver/billboard.js/issues/871
|
|
367
380
|
chartDesign.data!.labels = {
|
|
368
381
|
colors: chartDesign.data!.columns!.reduce((a, c) => {
|
|
369
|
-
a[c[0] as string] =
|
|
382
|
+
a[c[0] as string] = "#000"
|
|
370
383
|
return a
|
|
371
384
|
}, {})
|
|
372
385
|
}
|
|
373
|
-
if(!options.design.transpose) {
|
|
386
|
+
if (!options.design.transpose) {
|
|
374
387
|
chartDesign.data!.labels = {
|
|
375
388
|
...chartDesign.data!.labels,
|
|
376
389
|
position: {
|
|
377
390
|
y: 15
|
|
378
|
-
} as any
|
|
391
|
+
} as any // TODO why does this not type correctly?
|
|
379
392
|
}
|
|
380
393
|
}
|
|
381
394
|
}
|
|
382
395
|
|
|
383
|
-
if(_.isEmpty(chartDesign.data!.types)) {
|
|
396
|
+
if (_.isEmpty(chartDesign.data!.types)) {
|
|
384
397
|
chartDesign.data!.type = this.getLayerType(options.design, 0)
|
|
385
398
|
}
|
|
386
399
|
|
|
@@ -403,15 +416,15 @@ export default class LayeredChartCompiler {
|
|
|
403
416
|
if (options.design.labels && !_.isEmpty(c3Data.format)) {
|
|
404
417
|
// format = _.map options.design.layers, (layer, layerIndex) =>
|
|
405
418
|
// return if c3Data.format[layerIndex] then c3Data.format[layerIndex] else true
|
|
406
|
-
chartDesign.data!.labels = {
|
|
407
|
-
...chartDesign.data!.labels as any,
|
|
419
|
+
chartDesign.data!.labels = {
|
|
420
|
+
...(chartDesign.data!.labels as any),
|
|
408
421
|
format: c3Data.format
|
|
409
422
|
}
|
|
410
423
|
}
|
|
411
424
|
|
|
412
425
|
if (options.design.yThresholds) {
|
|
413
426
|
chartDesign.grid!.y = {
|
|
414
|
-
lines: _.map(options.design.yThresholds,
|
|
427
|
+
lines: _.map(options.design.yThresholds, t => ({
|
|
415
428
|
value: t.value!,
|
|
416
429
|
text: t.label!
|
|
417
430
|
}))
|
|
@@ -428,7 +441,7 @@ export default class LayeredChartCompiler {
|
|
|
428
441
|
|
|
429
442
|
isCategoricalX(design: LayeredChartDesign) {
|
|
430
443
|
// Check if categorical x axis (bar charts always are)
|
|
431
|
-
let categoricalX = design.type === "bar" || _.any(design.layers,
|
|
444
|
+
let categoricalX = design.type === "bar" || _.any(design.layers, l => l.type === "bar")
|
|
432
445
|
|
|
433
446
|
// Check if x axis is categorical type
|
|
434
447
|
const xType = this.axisBuilder.getAxisType(design.layers[0].axes.x)
|
|
@@ -448,7 +461,7 @@ export default class LayeredChartCompiler {
|
|
|
448
461
|
// Outputs: columns, types, names, colors. Also dataMap which is a map of "layername:index" to { layerIndex, row }
|
|
449
462
|
compileData(design: LayeredChartDesign, data: C3ChartData, locale?: string): C3Data {
|
|
450
463
|
// If polar chart (no x axis)
|
|
451
|
-
if (["pie", "donut"].includes(design.type) || _.any(design.layers,
|
|
464
|
+
if (["pie", "donut"].includes(design.type) || _.any(design.layers, l => ["pie", "donut"].includes(l.type))) {
|
|
452
465
|
return this.compileDataPolar(design, data, locale)
|
|
453
466
|
}
|
|
454
467
|
|
|
@@ -482,7 +495,7 @@ export default class LayeredChartCompiler {
|
|
|
482
495
|
const categoryOrder = _.zipObject(_.map(categories, (c, i) => [c.value, i]))
|
|
483
496
|
|
|
484
497
|
// Sort by category order
|
|
485
|
-
layerData = _.sortBy(layerData,
|
|
498
|
+
layerData = _.sortBy(layerData, row => categoryOrder[row.color])
|
|
486
499
|
|
|
487
500
|
// Create a series for each row
|
|
488
501
|
_.each(layerData, (row, rowIndex) => {
|
|
@@ -578,7 +591,7 @@ export default class LayeredChartCompiler {
|
|
|
578
591
|
}
|
|
579
592
|
|
|
580
593
|
// Remove excluded values
|
|
581
|
-
layerData = _.filter(layerData,
|
|
594
|
+
layerData = _.filter(layerData, row => !_.includes(layer.axes.x!.excludedValues || [], row.x))
|
|
582
595
|
|
|
583
596
|
// If has color axis
|
|
584
597
|
if (layer.axes.color) {
|
|
@@ -593,13 +606,13 @@ export default class LayeredChartCompiler {
|
|
|
593
606
|
const categoryOrder = _.zipObject(_.map(categories, (c, i) => [c.value, i]))
|
|
594
607
|
|
|
595
608
|
// Sort
|
|
596
|
-
colorValues = _.sortBy(colorValues,
|
|
609
|
+
colorValues = _.sortBy(colorValues, v => categoryOrder[v])
|
|
597
610
|
|
|
598
611
|
// Exclude excluded ones
|
|
599
612
|
colorValues = _.difference(colorValues, layer.axes.color.excludedValues || [])
|
|
600
613
|
|
|
601
614
|
// For each color value
|
|
602
|
-
_.each(colorValues,
|
|
615
|
+
_.each(colorValues, colorValue => {
|
|
603
616
|
// One series for x values, one for y
|
|
604
617
|
const seriesX = `${layerIndex}:${colorValue}:x`
|
|
605
618
|
const seriesY = `${layerIndex}:${colorValue}:y`
|
|
@@ -728,7 +741,7 @@ export default class LayeredChartCompiler {
|
|
|
728
741
|
|
|
729
742
|
for (var x of xs) {
|
|
730
743
|
// Find existing row
|
|
731
|
-
const existingRow = _.find(flatRows,
|
|
744
|
+
const existingRow = _.find(flatRows, r => r.x === x && r.color === row.color)
|
|
732
745
|
if (existingRow) {
|
|
733
746
|
existingRow.y += row.y
|
|
734
747
|
} else {
|
|
@@ -770,13 +783,16 @@ export default class LayeredChartCompiler {
|
|
|
770
783
|
})
|
|
771
784
|
|
|
772
785
|
// Categories will be in form [{ value, label }]
|
|
773
|
-
let categories = this.axisBuilder.getCategories(xAxis, xValues, {
|
|
786
|
+
let categories = this.axisBuilder.getCategories(xAxis, xValues, {
|
|
787
|
+
locale,
|
|
788
|
+
onlyValuesPresent: design.layers[0].xAxisOnlyValuesPresent
|
|
789
|
+
})
|
|
774
790
|
|
|
775
791
|
// Get indexed ordering of categories (lookup from value to index) without removing excluded values
|
|
776
792
|
const categoryOrder = _.zipObject(_.map(categories, (c, i) => [c.value, i]))
|
|
777
793
|
|
|
778
794
|
// Exclude excluded values
|
|
779
|
-
categories = _.filter(categories,
|
|
795
|
+
categories = _.filter(categories, category => !_.includes(xAxis.excludedValues || [], category.value))
|
|
780
796
|
|
|
781
797
|
// Limit categories to prevent crashes in C3 (https://github.com/mWater/mwater-visualization/issues/272)
|
|
782
798
|
if (xType !== "enumset") {
|
|
@@ -789,7 +805,7 @@ export default class LayeredChartCompiler {
|
|
|
789
805
|
const categoryMap = _.object(_.map(categories, (c, i) => [c.value, i]))
|
|
790
806
|
|
|
791
807
|
// Create common x series
|
|
792
|
-
columns.push(["x"].concat(_.map(categories,
|
|
808
|
+
columns.push(["x"].concat(_.map(categories, category => this.axisBuilder.formatCategory(xAxis, category))))
|
|
793
809
|
|
|
794
810
|
// For each layer
|
|
795
811
|
_.each(design.layers, (layer, layerIndex) => {
|
|
@@ -806,7 +822,7 @@ export default class LayeredChartCompiler {
|
|
|
806
822
|
}
|
|
807
823
|
|
|
808
824
|
// Reorder to category order for x-axis
|
|
809
|
-
layerData = _.sortBy(layerData,
|
|
825
|
+
layerData = _.sortBy(layerData, row => categoryOrder[row.x])
|
|
810
826
|
|
|
811
827
|
// Make rows cumulative
|
|
812
828
|
if (layer.cumulative) {
|
|
@@ -815,7 +831,7 @@ export default class LayeredChartCompiler {
|
|
|
815
831
|
|
|
816
832
|
// Filter out categories that were removed
|
|
817
833
|
if (xType !== "enumset") {
|
|
818
|
-
layerData = _.filter(layerData,
|
|
834
|
+
layerData = _.filter(layerData, row => categoryXs[row.x] != null)
|
|
819
835
|
}
|
|
820
836
|
|
|
821
837
|
// If has color axis
|
|
@@ -831,13 +847,13 @@ export default class LayeredChartCompiler {
|
|
|
831
847
|
const colorCategoryOrder = _.zipObject(_.map(colorCategories, (c, i) => [c.value, i]))
|
|
832
848
|
|
|
833
849
|
// Sort
|
|
834
|
-
colorValues = _.sortBy(colorValues,
|
|
850
|
+
colorValues = _.sortBy(colorValues, v => colorCategoryOrder[v])
|
|
835
851
|
|
|
836
852
|
// Exclude excluded ones
|
|
837
853
|
colorValues = _.difference(colorValues, layer.axes.color.excludedValues || [])
|
|
838
854
|
|
|
839
855
|
if (colorValues.length > 0) {
|
|
840
|
-
_.each(colorValues,
|
|
856
|
+
_.each(colorValues, colorValue => {
|
|
841
857
|
// One series for y values
|
|
842
858
|
const series = `${layerIndex}:${colorValue}`
|
|
843
859
|
|
|
@@ -852,10 +868,10 @@ export default class LayeredChartCompiler {
|
|
|
852
868
|
const rows = _.where(layerData, { color: colorValue })
|
|
853
869
|
|
|
854
870
|
// Create empty series
|
|
855
|
-
const column: any[] = _.map(categories,
|
|
871
|
+
const column: any[] = _.map(categories, c => null)
|
|
856
872
|
|
|
857
873
|
// Set rows
|
|
858
|
-
_.each(rows,
|
|
874
|
+
_.each(rows, row => {
|
|
859
875
|
// Get index
|
|
860
876
|
const index = categoryMap[row.x]
|
|
861
877
|
if (index != null) {
|
|
@@ -885,7 +901,7 @@ export default class LayeredChartCompiler {
|
|
|
885
901
|
} else {
|
|
886
902
|
//c3 acts funny when there is a split axis but no data
|
|
887
903
|
series = `${layerIndex}:dumm`
|
|
888
|
-
column = _.map(categories,
|
|
904
|
+
column = _.map(categories, c => null)
|
|
889
905
|
columns.push([series].concat(column))
|
|
890
906
|
|
|
891
907
|
types[series] = this.getLayerType(design, layerIndex)
|
|
@@ -899,10 +915,10 @@ export default class LayeredChartCompiler {
|
|
|
899
915
|
series = `${layerIndex}`
|
|
900
916
|
|
|
901
917
|
// Create empty series
|
|
902
|
-
column = _.map(categories,
|
|
918
|
+
column = _.map(categories, c => null)
|
|
903
919
|
|
|
904
920
|
// Set rows
|
|
905
|
-
_.each(layerData,
|
|
921
|
+
_.each(layerData, row => {
|
|
906
922
|
// Skip if value excluded
|
|
907
923
|
if (_.includes(layer.axes.x!.excludedValues || [], row.x)) {
|
|
908
924
|
return
|
|
@@ -947,9 +963,9 @@ export default class LayeredChartCompiler {
|
|
|
947
963
|
xs[trendlineSeries] = "x"
|
|
948
964
|
colors[trendlineSeries] = layer.color || defaultColors[layerIndex]
|
|
949
965
|
legendHide.push(trendlineSeries) // Hide in legend
|
|
950
|
-
format[trendlineSeries] = (value: any) =>
|
|
966
|
+
format[trendlineSeries] = (value: any) =>
|
|
951
967
|
value != null ? this.axisBuilder.formatValue(layer.axes.y!, d3Round(value), locale, true) : ""
|
|
952
|
-
|
|
968
|
+
|
|
953
969
|
// Set dots as invisible in CSS and line as dashed
|
|
954
970
|
classes[trendlineSeries] = "trendline"
|
|
955
971
|
}
|
|
@@ -968,12 +984,12 @@ export default class LayeredChartCompiler {
|
|
|
968
984
|
const stacked = layer.stacked != null ? layer.stacked : defaultStacked
|
|
969
985
|
|
|
970
986
|
if (stacked) {
|
|
971
|
-
groups.push(_.filter(_.keys(names),
|
|
987
|
+
groups.push(_.filter(_.keys(names), series => series.split(":")[0] === `${layerIndex}`))
|
|
972
988
|
}
|
|
973
989
|
}
|
|
974
990
|
|
|
975
991
|
// Remove empty groups
|
|
976
|
-
groups = _.filter(groups,
|
|
992
|
+
groups = _.filter(groups, g => g.length > 1)
|
|
977
993
|
}
|
|
978
994
|
|
|
979
995
|
// If proportional
|
|
@@ -987,7 +1003,7 @@ export default class LayeredChartCompiler {
|
|
|
987
1003
|
continue
|
|
988
1004
|
}
|
|
989
1005
|
|
|
990
|
-
for (let i = 1
|
|
1006
|
+
for (let i = 1; i < column.length; i++) {
|
|
991
1007
|
xtotals[i] = (xtotals[i] || 0) + (column[i] || 0)
|
|
992
1008
|
}
|
|
993
1009
|
}
|
|
@@ -1000,7 +1016,7 @@ export default class LayeredChartCompiler {
|
|
|
1000
1016
|
continue
|
|
1001
1017
|
}
|
|
1002
1018
|
|
|
1003
|
-
for (let i = 1
|
|
1019
|
+
for (let i = 1; i < column.length; i++) {
|
|
1004
1020
|
if (column[i] > 0) {
|
|
1005
1021
|
column[i] = Math.round(((100 * column[i]) / xtotals[i]) * 10) / 10
|
|
1006
1022
|
}
|
|
@@ -1020,6 +1036,7 @@ export default class LayeredChartCompiler {
|
|
|
1020
1036
|
classes,
|
|
1021
1037
|
xAxisType: "category",
|
|
1022
1038
|
xAxisTickFit: xType !== "date", // Put a tick for each point since categorical unless date
|
|
1039
|
+
xAxisTickMultiline: design.xAxisTickMultiline,
|
|
1023
1040
|
xAxisLabelText: this.compileXAxisLabelText(design, locale),
|
|
1024
1041
|
yAxisLabelText: this.compileYAxisLabelText(design, locale),
|
|
1025
1042
|
titleText: this.compileTitleText(design, locale),
|
|
@@ -1057,13 +1074,13 @@ export default class LayeredChartCompiler {
|
|
|
1057
1074
|
}
|
|
1058
1075
|
|
|
1059
1076
|
// Get layer type, defaulting to overall type
|
|
1060
|
-
getLayerType(design: any, layerIndex: any) {
|
|
1077
|
+
getLayerType(design: any, layerIndex: any) {
|
|
1061
1078
|
// Special handling for mocha tests where chartTypes has all undefined values
|
|
1062
1079
|
// See https://github.com/mWater/mwater-visualization/issues/453#issuecomment-1103671467
|
|
1063
1080
|
const chartTypeString = design.layers[layerIndex].type || design.type
|
|
1064
1081
|
if (chartTypes[chartTypeString]) {
|
|
1065
1082
|
return chartTypes[chartTypeString]()
|
|
1066
|
-
}
|
|
1083
|
+
}
|
|
1067
1084
|
return chartTypeString
|
|
1068
1085
|
}
|
|
1069
1086
|
|
|
@@ -1269,7 +1286,7 @@ function cleanString(str: any) {
|
|
|
1269
1286
|
function calculateLinearRegression(ys: any[], xs: any[]): any[] {
|
|
1270
1287
|
// If xs are dates, convert to numbers
|
|
1271
1288
|
if (_.isString(xs[0])) {
|
|
1272
|
-
xs = _.map(xs,
|
|
1289
|
+
xs = _.map(xs, x => Date.parse(x))
|
|
1273
1290
|
}
|
|
1274
1291
|
|
|
1275
1292
|
// Remove null ys
|
|
@@ -1280,7 +1297,7 @@ function calculateLinearRegression(ys: any[], xs: any[]): any[] {
|
|
|
1280
1297
|
|
|
1281
1298
|
const sumXY = _.sum(_.map(nonNullxs, (x, i) => x * nonNullys[i]))
|
|
1282
1299
|
|
|
1283
|
-
const sumXX = _.sum(_.map(nonNullxs,
|
|
1300
|
+
const sumXX = _.sum(_.map(nonNullxs, x => x * x))
|
|
1284
1301
|
|
|
1285
1302
|
const sumX = _.sum(nonNullxs)
|
|
1286
1303
|
|
|
@@ -1295,5 +1312,5 @@ function calculateLinearRegression(ys: any[], xs: any[]): any[] {
|
|
|
1295
1312
|
// Calculate intercept
|
|
1296
1313
|
const intercept = (sumY * sumXX - sumX * sumXY) / den
|
|
1297
1314
|
|
|
1298
|
-
return _.map(xs,
|
|
1315
|
+
return _.map(xs, x => x * slope + intercept)
|
|
1299
1316
|
}
|
|
@@ -56,6 +56,12 @@ export interface LayeredChartDesign {
|
|
|
56
56
|
|
|
57
57
|
/** true to show popout lines for small values */
|
|
58
58
|
popoutSmallValues?: boolean
|
|
59
|
+
|
|
60
|
+
/** true to hide the legend */
|
|
61
|
+
hideLegend?: boolean
|
|
62
|
+
|
|
63
|
+
/** Whether to allow multiline x axis tick labels (default true) */
|
|
64
|
+
xAxisTickMultiline?: boolean
|
|
59
65
|
}
|
|
60
66
|
|
|
61
67
|
export interface LayeredChartDesignLayer {
|
|
@@ -103,4 +109,4 @@ export interface YThreshold {
|
|
|
103
109
|
value: number | null
|
|
104
110
|
label: string | null
|
|
105
111
|
highlightColor: string | null
|
|
106
|
-
}
|
|
112
|
+
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import _ from "lodash"
|
|
2
|
-
import PropTypes from "prop-types"
|
|
3
2
|
import React from "react"
|
|
4
3
|
const R = React.createElement
|
|
5
4
|
import LayeredChartLayerDesignerComponent from "./LayeredChartLayerDesignerComponent"
|
|
@@ -41,6 +40,10 @@ export default class LayeredChartDesignerComponent extends React.Component<Layer
|
|
|
41
40
|
return this.updateDesign({ transpose: value })
|
|
42
41
|
}
|
|
43
42
|
|
|
43
|
+
handleHideLegendChange = (value: any) => {
|
|
44
|
+
return this.updateDesign({ hideLegend: value })
|
|
45
|
+
}
|
|
46
|
+
|
|
44
47
|
handleStackedChange = (value: any) => {
|
|
45
48
|
return this.updateDesign({ stacked: value })
|
|
46
49
|
}
|
|
@@ -104,6 +107,10 @@ export default class LayeredChartDesignerComponent extends React.Component<Layer
|
|
|
104
107
|
return this.updateDesign({ yMax })
|
|
105
108
|
}
|
|
106
109
|
|
|
110
|
+
handleXAxisTickMultilineChange = (value: boolean) => {
|
|
111
|
+
this.updateDesign({ xAxisTickMultiline: value })
|
|
112
|
+
}
|
|
113
|
+
|
|
107
114
|
renderLabels() {
|
|
108
115
|
if (!this.props.design.type) {
|
|
109
116
|
return
|
|
@@ -178,6 +185,19 @@ export default class LayeredChartDesignerComponent extends React.Component<Layer
|
|
|
178
185
|
)
|
|
179
186
|
}
|
|
180
187
|
|
|
188
|
+
renderChartOptions() {
|
|
189
|
+
return (
|
|
190
|
+
<div>
|
|
191
|
+
<Checkbox key="hideLegend" value={this.props.design.hideLegend} onChange={this.handleHideLegendChange}>
|
|
192
|
+
Hide legend
|
|
193
|
+
</Checkbox>
|
|
194
|
+
<Checkbox key="xAxisTickMultiline" value={this.props.design.xAxisTickMultiline ?? true} onChange={this.handleXAxisTickMultilineChange}>
|
|
195
|
+
Multiline X-Axis Labels
|
|
196
|
+
</Checkbox>
|
|
197
|
+
</div>
|
|
198
|
+
)
|
|
199
|
+
}
|
|
200
|
+
|
|
181
201
|
renderType() {
|
|
182
202
|
const chartTypes = [
|
|
183
203
|
{ id: "bar", name: "Bar", desc: "Best for most charts" },
|
|
@@ -200,7 +220,7 @@ export default class LayeredChartDesignerComponent extends React.Component<Layer
|
|
|
200
220
|
editor: (onClose: any) => {
|
|
201
221
|
return R(uiComponents.OptionListComponent, {
|
|
202
222
|
hint: "Select a Chart Type",
|
|
203
|
-
items: _.map(chartTypes,
|
|
223
|
+
items: _.map(chartTypes, ct => ({
|
|
204
224
|
name: ct.name,
|
|
205
225
|
desc: ct.desc,
|
|
206
226
|
onClick: () => {
|
|
@@ -298,8 +318,7 @@ export default class LayeredChartDesignerComponent extends React.Component<Layer
|
|
|
298
318
|
key="percentVisible"
|
|
299
319
|
inline
|
|
300
320
|
value={design.hidePercentage}
|
|
301
|
-
onChange={this.handlePercentageVisibilityChange}
|
|
302
|
-
>
|
|
321
|
+
onChange={this.handlePercentageVisibilityChange}>
|
|
303
322
|
Hide Percentage
|
|
304
323
|
</Checkbox>,
|
|
305
324
|
<Select
|
|
@@ -315,11 +334,19 @@ export default class LayeredChartDesignerComponent extends React.Component<Layer
|
|
|
315
334
|
/>
|
|
316
335
|
]
|
|
317
336
|
: undefined,
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
337
|
+
design.labels && design.type === "bar" && !design.transpose
|
|
338
|
+
? R(
|
|
339
|
+
"div",
|
|
340
|
+
null,
|
|
341
|
+
<Checkbox
|
|
342
|
+
inline
|
|
343
|
+
key="labels"
|
|
344
|
+
value={design.popoutSmallValues || false}
|
|
345
|
+
onChange={this.handleLabelsPopoutChange}>
|
|
346
|
+
Show Popout labels for small values
|
|
347
|
+
</Checkbox>
|
|
348
|
+
)
|
|
349
|
+
: undefined
|
|
323
350
|
)
|
|
324
351
|
}
|
|
325
352
|
|
|
@@ -400,6 +427,12 @@ export default class LayeredChartDesignerComponent extends React.Component<Layer
|
|
|
400
427
|
})
|
|
401
428
|
}
|
|
402
429
|
|
|
430
|
+
tabs.push({
|
|
431
|
+
id: "options",
|
|
432
|
+
label: "Options",
|
|
433
|
+
elem: R("div", null, R("br"), this.renderChartOptions())
|
|
434
|
+
})
|
|
435
|
+
|
|
403
436
|
return R(TabbedComponent, {
|
|
404
437
|
initialTabId: "design",
|
|
405
438
|
tabs
|
|
@@ -472,7 +505,7 @@ class ThresholdComponent extends React.Component<{
|
|
|
472
505
|
style: { display: "inline-block" },
|
|
473
506
|
size: "sm",
|
|
474
507
|
value: this.props.threshold.value,
|
|
475
|
-
onChange:
|
|
508
|
+
onChange: v => this.props.onThresholdChange(_.extend({}, this.props.threshold, { value: v }))
|
|
476
509
|
})
|
|
477
510
|
),
|
|
478
511
|
" ",
|
|
@@ -187,7 +187,7 @@ export default class LayeredChartLayerDesignerComponent extends React.Component<
|
|
|
187
187
|
}
|
|
188
188
|
|
|
189
189
|
handlexAxisOnlyValuesPresentChange = (xAxisOnlyValuesPresent: boolean) => {
|
|
190
|
-
this.updateLayer({xAxisOnlyValuesPresent})
|
|
190
|
+
this.updateLayer({ xAxisOnlyValuesPresent })
|
|
191
191
|
}
|
|
192
192
|
|
|
193
193
|
renderXAxis() {
|
|
@@ -238,11 +238,11 @@ export default class LayeredChartLayerDesignerComponent extends React.Component<
|
|
|
238
238
|
categoricalX ? R(ui.Checkbox, {
|
|
239
239
|
value: layer.xAxisOnlyValuesPresent,
|
|
240
240
|
onChange: this.handlexAxisOnlyValuesPresentChange
|
|
241
|
-
},
|
|
242
|
-
"Only show values actually present",
|
|
243
|
-
R(PopoverHelpComponent, {placement: 'bottom'}, "Limits values to those that are present in the data, as opposed to all choices or all dates within range")
|
|
244
|
-
):
|
|
245
|
-
|
|
241
|
+
},
|
|
242
|
+
"Only show values actually present ",
|
|
243
|
+
R(PopoverHelpComponent, { placement: 'bottom' }, "Limits values to those that are present in the data, as opposed to all choices or all dates within range")
|
|
244
|
+
) : null,
|
|
245
|
+
<br/>
|
|
246
246
|
]
|
|
247
247
|
}
|
|
248
248
|
|