@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
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import PropTypes from "prop-types"
|
|
2
1
|
import _ from "lodash"
|
|
3
2
|
import React from "react"
|
|
4
|
-
import ReactDOM from "react-dom"
|
|
5
3
|
const R = React.createElement
|
|
6
4
|
|
|
7
5
|
import { DataSource, ExprUtils, Schema } from "@mwater/expressions"
|
|
@@ -9,8 +7,10 @@ import LayeredChartCompiler from "./LayeredChartCompiler"
|
|
|
9
7
|
import TextComponent from "../../text/TextComponent"
|
|
10
8
|
import * as d3 from "d3"
|
|
11
9
|
import { LayeredChartDesign } from "./LayeredChartDesign"
|
|
12
|
-
import c3 from
|
|
10
|
+
import c3 from "billboard.js"
|
|
13
11
|
import { WidgetScope } from "../../../WidgetScope"
|
|
12
|
+
import { LocaleContext } from "@mwater/expressions-ui/lib/contexts"
|
|
13
|
+
import { isEmptyTextWidgetDesign } from "../../text/TextWidgetDesign"
|
|
14
14
|
|
|
15
15
|
export interface LayeredChartViewComponentProps {
|
|
16
16
|
schema: Schema
|
|
@@ -36,7 +36,7 @@ export default class LayeredChartViewComponent extends React.Component<
|
|
|
36
36
|
LayeredChartViewComponentProps,
|
|
37
37
|
LayeredChartViewComponentState
|
|
38
38
|
> {
|
|
39
|
-
static
|
|
39
|
+
static contextType = LocaleContext
|
|
40
40
|
header: HTMLElement | null
|
|
41
41
|
footer: HTMLElement | null
|
|
42
42
|
|
|
@@ -60,9 +60,9 @@ export default class LayeredChartViewComponent extends React.Component<
|
|
|
60
60
|
this.props.height != prevProps.height ||
|
|
61
61
|
this.props.width != prevProps.width
|
|
62
62
|
) {
|
|
63
|
-
console.log(
|
|
64
|
-
|
|
65
|
-
)
|
|
63
|
+
// console.log(
|
|
64
|
+
// `componentDidUpdate: ${this.props.height} vs ${prevProps.height} and ${this.props.width} vs ${prevProps.width}`
|
|
65
|
+
// )
|
|
66
66
|
this.updateHeights()
|
|
67
67
|
}
|
|
68
68
|
}
|
|
@@ -70,15 +70,15 @@ export default class LayeredChartViewComponent extends React.Component<
|
|
|
70
70
|
updateHeights() {
|
|
71
71
|
// Calculate header and footer heights
|
|
72
72
|
if (this.header && this.state.headerHeight !== this.header.offsetHeight) {
|
|
73
|
-
console.log(
|
|
74
|
-
|
|
75
|
-
)
|
|
73
|
+
// console.log(
|
|
74
|
+
// `headerHeight: ${this.state.headerHeight} vs ${this.header.offsetHeight} => ${this.header.offsetHeight}`
|
|
75
|
+
// )
|
|
76
76
|
this.setState({ headerHeight: this.header.offsetHeight })
|
|
77
77
|
}
|
|
78
78
|
if (this.footer && this.state.footerHeight !== this.footer.offsetHeight) {
|
|
79
|
-
console.log(
|
|
80
|
-
|
|
81
|
-
)
|
|
79
|
+
// console.log(
|
|
80
|
+
// `footerHeight: ${this.state.footerHeight} vs ${this.footer.offsetHeight} => ${this.footer.offsetHeight}`
|
|
81
|
+
// )
|
|
82
82
|
this.setState({ footerHeight: this.footer.offsetHeight })
|
|
83
83
|
}
|
|
84
84
|
}
|
|
@@ -95,7 +95,7 @@ export default class LayeredChartViewComponent extends React.Component<
|
|
|
95
95
|
return R(
|
|
96
96
|
"div",
|
|
97
97
|
{
|
|
98
|
-
ref:
|
|
98
|
+
ref: c => {
|
|
99
99
|
return (this.header = c)
|
|
100
100
|
}
|
|
101
101
|
},
|
|
@@ -114,11 +114,12 @@ export default class LayeredChartViewComponent extends React.Component<
|
|
|
114
114
|
return R(
|
|
115
115
|
"div",
|
|
116
116
|
{
|
|
117
|
-
ref:
|
|
117
|
+
ref: c => {
|
|
118
118
|
return (this.footer = c)
|
|
119
119
|
}
|
|
120
120
|
},
|
|
121
|
-
|
|
121
|
+
// Don't render footer if it's empty and no onDesignChange
|
|
122
|
+
isEmptyTextWidgetDesign(this.props.design.footer) && this.props.onDesignChange == null ? null : R(TextComponent, {
|
|
122
123
|
design: this.props.design.footer!,
|
|
123
124
|
onDesignChange: this.props.onDesignChange ? this.handleFooterChange : undefined,
|
|
124
125
|
schema: this.props.schema,
|
|
@@ -144,7 +145,7 @@ export default class LayeredChartViewComponent extends React.Component<
|
|
|
144
145
|
height: this.props.height - this.state.headerHeight - this.state.footerHeight,
|
|
145
146
|
scope: this.props.scope,
|
|
146
147
|
onScopeChange: this.props.onScopeChange,
|
|
147
|
-
locale: this.context
|
|
148
|
+
locale: this.context
|
|
148
149
|
})
|
|
149
150
|
: undefined,
|
|
150
151
|
this.renderFooter()
|
|
@@ -206,14 +207,37 @@ class C3ChartComponent extends React.Component<C3ChartComponentProps> {
|
|
|
206
207
|
// const c3 = require("c3")
|
|
207
208
|
// console.log(chartOptions)
|
|
208
209
|
try {
|
|
209
|
-
this.chart = c3.generate(chartOptions)
|
|
210
|
+
this.chart = c3.generate(chartOptions)
|
|
210
211
|
} catch (error) {
|
|
211
|
-
|
|
212
|
-
|
|
212
|
+
throw error
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
const el = this.chartDiv
|
|
216
|
+
// https://github.com/mWater/monorepo/issues/8
|
|
217
|
+
if (props.design.type === "bar" && props.design.stacked && props.design.transpose) {
|
|
218
|
+
d3.select(el)
|
|
219
|
+
.selectAll(".bb-chart-text .bb-text")
|
|
220
|
+
.each(function (t: any, i: number) {
|
|
221
|
+
const bar = d3
|
|
222
|
+
.select(el)
|
|
223
|
+
.selectAll(".bb-chart-bar .bb-bar")
|
|
224
|
+
.filter((d: any) => {
|
|
225
|
+
return d.id === t.id && t.index === d.index
|
|
226
|
+
})
|
|
227
|
+
.nodes()[0] as SVGAElement
|
|
228
|
+
|
|
229
|
+
const text = d3.select(this)
|
|
230
|
+
const barBox = bar.getBBox()
|
|
231
|
+
const textBox = (text.nodes()[0]! as SVGAElement).getBBox()
|
|
232
|
+
|
|
233
|
+
if (barBox.width > textBox.width + 10) {
|
|
234
|
+
text.attr("x", barBox.x + (barBox.width - textBox.width) / 2)
|
|
235
|
+
} else {
|
|
236
|
+
text.style("opacity", 0)
|
|
237
|
+
}
|
|
238
|
+
})
|
|
213
239
|
}
|
|
214
|
-
|
|
215
240
|
|
|
216
|
-
console.log(this.chartDiv)
|
|
217
241
|
// Remove listener for window focus (https://github.com/c3js/c3/issues/2742)
|
|
218
242
|
window.removeEventListener("focus", this.chart.internal.windowFocusHandler)
|
|
219
243
|
this.chart.internal.windowFocusHandler = () => {}
|
|
@@ -275,90 +299,108 @@ class C3ChartComponent extends React.Component<C3ChartComponentProps> {
|
|
|
275
299
|
const compiler = new LayeredChartCompiler({ schema: this.props.schema })
|
|
276
300
|
const el = this.chartDiv
|
|
277
301
|
|
|
278
|
-
if(!this.props.design.transpose && this.props.design.popoutSmallValues) {
|
|
302
|
+
if (!this.props.design.transpose && this.props.design.popoutSmallValues) {
|
|
279
303
|
const stacked = this.props.design.stacked
|
|
280
|
-
|
|
304
|
+
|
|
281
305
|
let barWidth = 20
|
|
282
306
|
const smalls: any[] = []
|
|
283
307
|
const map = new Map()
|
|
284
308
|
let _id = 0
|
|
285
309
|
d3.select(el)
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
310
|
+
.selectAll(".bb-chart-bar .bb-bar")
|
|
311
|
+
.each(function (p: any, i) {
|
|
312
|
+
if (!map.has(p.id)) {
|
|
313
|
+
map.set(p.id, _id++)
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
const box = (d3.select(this).nodes()[0]! as SVGAElement).getBBox()
|
|
317
|
+
barWidth = box.width
|
|
318
|
+
|
|
319
|
+
if (box.height < 12) {
|
|
320
|
+
d3.select(el)
|
|
321
|
+
.selectAll(".bb-chart-text .bb-text")
|
|
322
|
+
.filter(function (p, j) {
|
|
323
|
+
return i === j
|
|
324
|
+
})
|
|
325
|
+
.each(function (_p: any) {
|
|
326
|
+
smalls.push({
|
|
327
|
+
origin_x: box.x, // + box.width,
|
|
328
|
+
origin_y: box.y,
|
|
329
|
+
series: map.get(p.id),
|
|
330
|
+
textY: box.y - 12 * map.get(p.id) - 10,
|
|
331
|
+
textX: box.x + 25
|
|
332
|
+
})
|
|
333
|
+
;(d3.select(this).node() as SVGAElement).classList.add("needs_adjustment")
|
|
334
|
+
})
|
|
335
|
+
.attr("data-boxX", box.x)
|
|
336
|
+
.attr("y", function () {
|
|
337
|
+
return box.y - 12 * map.get(p.id) - 10
|
|
338
|
+
// return Number(d3.select(this).attr('y')) - 7
|
|
339
|
+
})
|
|
340
|
+
}
|
|
341
|
+
})
|
|
342
|
+
|
|
343
|
+
if (smalls.length > 0) {
|
|
319
344
|
const sliceWidth = 4
|
|
320
345
|
|
|
321
|
-
const seriesToBeDrawn = _.uniq(smalls.map(
|
|
346
|
+
const seriesToBeDrawn = _.uniq(smalls.map(s => s.series)).length
|
|
322
347
|
|
|
323
348
|
d3.select(el)
|
|
324
349
|
.selectAll(".needs_adjustment")
|
|
325
|
-
.attr(
|
|
350
|
+
.attr("x", function () {
|
|
326
351
|
const self = d3.select(this)
|
|
327
|
-
return Number(self.attr(
|
|
352
|
+
return Number(self.attr("data-boxX")) + seriesToBeDrawn * sliceWidth + 10
|
|
328
353
|
})
|
|
329
|
-
.attr(
|
|
354
|
+
.attr("text-anchor", "left")
|
|
330
355
|
|
|
331
|
-
const hackGroup = d3
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
356
|
+
const hackGroup = d3
|
|
357
|
+
.select(el)
|
|
358
|
+
.selectAll(".bb-chart")
|
|
359
|
+
.selectAll(".popout_labels")
|
|
360
|
+
.data(["1"])
|
|
361
|
+
.enter()
|
|
362
|
+
.append("g")
|
|
363
|
+
.attr("class", "popout_labels")
|
|
338
364
|
|
|
339
365
|
hackGroup
|
|
340
|
-
.selectAll(
|
|
366
|
+
.selectAll("line")
|
|
341
367
|
.data(smalls)
|
|
342
368
|
.enter()
|
|
343
|
-
.append(
|
|
344
|
-
|
|
345
|
-
.
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
.
|
|
349
|
-
|
|
350
|
-
|
|
369
|
+
.append("line")
|
|
370
|
+
.attr("x1", function (d) {
|
|
371
|
+
return stacked ? d.origin_x + sliceWidth * (seriesToBeDrawn - d.series) : d.origin_x + 5
|
|
372
|
+
})
|
|
373
|
+
.attr("y1", function (d) {
|
|
374
|
+
return d.origin_y
|
|
375
|
+
})
|
|
376
|
+
.attr("x2", function (d) {
|
|
377
|
+
return stacked ? d.origin_x + sliceWidth * (seriesToBeDrawn - d.series) : d.origin_x + 5
|
|
378
|
+
})
|
|
379
|
+
.attr("y2", function (d) {
|
|
380
|
+
return d.textY + 3
|
|
381
|
+
})
|
|
382
|
+
.attr("shape-rendering", "crispEdges")
|
|
383
|
+
.style("stroke", "black")
|
|
384
|
+
.style("stroke-width", 0.5)
|
|
351
385
|
.exit()
|
|
352
386
|
.data(smalls)
|
|
353
387
|
.enter()
|
|
354
|
-
.append(
|
|
355
|
-
|
|
356
|
-
.
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
.
|
|
360
|
-
|
|
361
|
-
|
|
388
|
+
.append("line")
|
|
389
|
+
.attr("x1", function (d) {
|
|
390
|
+
return stacked ? d.origin_x + sliceWidth * (seriesToBeDrawn - d.series) : d.origin_x + 5
|
|
391
|
+
})
|
|
392
|
+
.attr("y1", function (d) {
|
|
393
|
+
return d.textY + 3
|
|
394
|
+
})
|
|
395
|
+
.attr("x2", function (d) {
|
|
396
|
+
return d.origin_x + seriesToBeDrawn * sliceWidth + 8
|
|
397
|
+
})
|
|
398
|
+
.attr("y2", function (d) {
|
|
399
|
+
return d.textY
|
|
400
|
+
})
|
|
401
|
+
.attr("shape-rendering", "crispEdges")
|
|
402
|
+
.style("stroke", "black")
|
|
403
|
+
.style("stroke-width", 0.5)
|
|
362
404
|
.exit()
|
|
363
405
|
}
|
|
364
406
|
}
|
|
@@ -399,7 +441,12 @@ class C3ChartComponent extends React.Component<C3ChartComponentProps> {
|
|
|
399
441
|
let scope
|
|
400
442
|
const dataPoint = this.lookupDataPoint(dataMap, d)
|
|
401
443
|
if (dataPoint) {
|
|
402
|
-
scope = compiler.createScope(
|
|
444
|
+
scope = compiler.createScope(
|
|
445
|
+
this.props.design,
|
|
446
|
+
dataPoint.layerIndex,
|
|
447
|
+
dataPoint.row,
|
|
448
|
+
this.props.locale || "en"
|
|
449
|
+
)
|
|
403
450
|
}
|
|
404
451
|
|
|
405
452
|
// Determine if scoped
|
|
@@ -452,7 +499,12 @@ class C3ChartComponent extends React.Component<C3ChartComponentProps> {
|
|
|
452
499
|
|
|
453
500
|
// Create scope
|
|
454
501
|
const compiler = new LayeredChartCompiler({ schema: this.props.schema })
|
|
455
|
-
const scope = compiler.createScope(
|
|
502
|
+
const scope = compiler.createScope(
|
|
503
|
+
this.props.design,
|
|
504
|
+
dataPoint.layerIndex,
|
|
505
|
+
dataPoint.row,
|
|
506
|
+
this.props.locale || "en"
|
|
507
|
+
)
|
|
456
508
|
|
|
457
509
|
// If same scope data, remove scope
|
|
458
510
|
if (this.props.scope && _.isEqual(scope.data, this.props.scope.data)) {
|
|
@@ -478,7 +530,7 @@ class C3ChartComponent extends React.Component<C3ChartComponentProps> {
|
|
|
478
530
|
// css += ".c3-title { font-size: #{scale * 14}px; }\n"
|
|
479
531
|
|
|
480
532
|
return R("div", {
|
|
481
|
-
ref:
|
|
533
|
+
ref: c => {
|
|
482
534
|
return (this.chartDiv = c)
|
|
483
535
|
}
|
|
484
536
|
})
|