@carbon/charts 0.32.9 → 0.33.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/CHANGELOG.md +331 -145
- package/README.md +18 -8
- package/axis-chart.js +20 -20
- package/axis-chart.js.map +1 -1
- package/build/demo/data/area.d.ts +17 -0
- package/build/demo/data/bar.d.ts +71 -0
- package/build/demo/data/line.d.ts +55 -0
- package/build/demo/data/scatter.d.ts +18 -0
- package/build/src/components/essentials/tooltip-bar.d.ts +2 -2
- package/build/src/components/essentials/tooltip-radar.d.ts +2 -1
- package/build/src/components/essentials/tooltip.d.ts +2 -2
- package/build/src/interfaces/axis-scales.d.ts +2 -0
- package/build/src/interfaces/charts.d.ts +5 -0
- package/build/src/interfaces/components.d.ts +2 -0
- package/build/src/interfaces/enums.d.ts +12 -1
- package/build/src/interfaces/truncation.d.ts +17 -0
- package/build/src/model.d.ts +1 -0
- package/build/src/tools.d.ts +9 -0
- package/bundle.js +1 -1
- package/charts/area-stacked.js +3 -3
- package/charts/area-stacked.js.map +1 -1
- package/charts/area.js +3 -3
- package/charts/area.js.map +1 -1
- package/charts/bar-grouped.js +3 -3
- package/charts/bar-grouped.js.map +1 -1
- package/charts/bar-simple.js +3 -3
- package/charts/bar-simple.js.map +1 -1
- package/charts/bar-stacked.js +3 -3
- package/charts/bar-stacked.js.map +1 -1
- package/charts/bubble.js +3 -3
- package/charts/bubble.js.map +1 -1
- package/charts/donut.js +3 -3
- package/charts/donut.js.map +1 -1
- package/charts/gauge.js +2 -1
- package/charts/gauge.js.map +1 -1
- package/charts/line.js +3 -3
- package/charts/line.js.map +1 -1
- package/charts/pie.js +3 -3
- package/charts/pie.js.map +1 -1
- package/charts/radar.js +1 -1
- package/charts/radar.js.map +1 -1
- package/charts/scatter.js +3 -3
- package/charts/scatter.js.map +1 -1
- package/components/axes/axis.js +76 -14
- package/components/axes/axis.js.map +1 -1
- package/components/axes/grid.js +1 -1
- package/components/axes/grid.js.map +1 -1
- package/components/axes/ruler.js +2 -2
- package/components/axes/ruler.js.map +1 -1
- package/components/axes/two-dimensional-axes.js +3 -3
- package/components/axes/two-dimensional-axes.js.map +1 -1
- package/components/axes/zero-line.js +1 -1
- package/components/axes/zero-line.js.map +1 -1
- package/components/essentials/legend.js +53 -11
- package/components/essentials/legend.js.map +1 -1
- package/components/essentials/threshold.js +9 -9
- package/components/essentials/threshold.js.map +1 -1
- package/components/essentials/title.js +2 -2
- package/components/essentials/title.js.map +1 -1
- package/components/essentials/tooltip-bar.d.ts +2 -2
- package/components/essentials/tooltip-bar.js +24 -10
- package/components/essentials/tooltip-bar.js.map +1 -1
- package/components/essentials/tooltip-pie.js +3 -0
- package/components/essentials/tooltip-pie.js.map +1 -1
- package/components/essentials/tooltip-radar.d.ts +2 -1
- package/components/essentials/tooltip-radar.js +1 -1
- package/components/essentials/tooltip-radar.js.map +1 -1
- package/components/essentials/tooltip-scatter.js +6 -0
- package/components/essentials/tooltip-scatter.js.map +1 -1
- package/components/essentials/tooltip.d.ts +2 -2
- package/components/essentials/tooltip.js +16 -11
- package/components/essentials/tooltip.js.map +1 -1
- package/components/graphs/area-stacked.js +8 -7
- package/components/graphs/area-stacked.js.map +1 -1
- package/components/graphs/bar-grouped.js +7 -7
- package/components/graphs/bar-grouped.js.map +1 -1
- package/components/graphs/bar-simple.js +6 -6
- package/components/graphs/bar-simple.js.map +1 -1
- package/components/graphs/bar-stacked.js +6 -6
- package/components/graphs/bar-stacked.js.map +1 -1
- package/components/graphs/gauge.js +7 -5
- package/components/graphs/gauge.js.map +1 -1
- package/components/graphs/line.js +14 -10
- package/components/graphs/line.js.map +1 -1
- package/components/graphs/pie.js +12 -12
- package/components/graphs/pie.js.map +1 -1
- package/components/graphs/radar.js +11 -11
- package/components/graphs/radar.js.map +1 -1
- package/components/graphs/scatter-stacked.js +2 -4
- package/components/graphs/scatter-stacked.js.map +1 -1
- package/components/graphs/scatter.js +6 -8
- package/components/graphs/scatter.js.map +1 -1
- package/components/graphs/skeleton.js +3 -3
- package/components/graphs/skeleton.js.map +1 -1
- package/components/layout/layout.js +10 -4
- package/components/layout/layout.js.map +1 -1
- package/configuration.js +26 -8
- package/configuration.js.map +1 -1
- package/demo/create-codesandbox.js +19 -19
- package/demo/create-codesandbox.js.map +1 -1
- package/demo/data/area.d.ts +17 -0
- package/demo/data/area.js +26 -0
- package/demo/data/area.js.map +1 -1
- package/demo/data/bar.d.ts +71 -0
- package/demo/data/bar.js +176 -95
- package/demo/data/bar.js.map +1 -1
- package/demo/data/bubble.js +29 -29
- package/demo/data/bubble.js.map +1 -1
- package/demo/data/bundle.js +1 -1
- package/demo/data/index.js +39 -1
- package/demo/data/index.js.map +1 -1
- package/demo/data/line.d.ts +55 -0
- package/demo/data/line.js +149 -50
- package/demo/data/line.js.map +1 -1
- package/demo/data/pie.js +5 -5
- package/demo/data/pie.js.map +1 -1
- package/demo/data/radar.js +12 -12
- package/demo/data/radar.js.map +1 -1
- package/demo/data/scatter.d.ts +18 -0
- package/demo/data/scatter.js +73 -22
- package/demo/data/scatter.js.map +1 -1
- package/demo/data/step.js +6 -6
- package/demo/data/step.js.map +1 -1
- package/demo/data/time-series-axis.js +107 -107
- package/demo/data/time-series-axis.js.map +1 -1
- package/demo/styles.css +32 -0
- package/demo/styles.css.map +1 -1
- package/demo/styles.min.css +1 -1
- package/demo/styles.min.css.map +1 -1
- package/demo/tsconfig.tsbuildinfo +50 -27
- package/interfaces/a11y.js.map +1 -1
- package/interfaces/axis-scales.d.ts +2 -0
- package/interfaces/axis-scales.js.map +1 -1
- package/interfaces/charts.d.ts +5 -0
- package/interfaces/charts.js.map +1 -1
- package/interfaces/components.d.ts +2 -0
- package/interfaces/components.js.map +1 -1
- package/interfaces/enums.d.ts +12 -1
- package/interfaces/enums.js +12 -0
- package/interfaces/enums.js.map +1 -1
- package/interfaces/events.js.map +1 -1
- package/interfaces/truncation.d.ts +17 -0
- package/interfaces/truncation.js +1 -0
- package/interfaces/truncation.js.map +1 -0
- package/model.d.ts +1 -0
- package/model.js +61 -5
- package/model.js.map +1 -1
- package/package.json +1 -1
- package/polyfills.js +1 -1
- package/polyfills.js.map +1 -1
- package/services/angle-utils.js +8 -8
- package/services/angle-utils.js.map +1 -1
- package/services/colorPalettes.js +2 -2
- package/services/colorPalettes.js.map +1 -1
- package/services/colors.js +1 -1
- package/services/colors.js.map +1 -1
- package/services/curves.js +2 -2
- package/services/curves.js.map +1 -1
- package/services/essentials/dom-utils.js +6 -6
- package/services/essentials/dom-utils.js.map +1 -1
- package/services/essentials/events.js +1 -1
- package/services/essentials/events.js.map +1 -1
- package/services/scales-cartesian.js +17 -17
- package/services/scales-cartesian.js.map +1 -1
- package/services/time-series.js +2 -2
- package/services/time-series.js.map +1 -1
- package/styles/components/_tooltip.scss +2 -0
- package/styles-g10.css +8 -0
- package/styles-g10.css.map +1 -1
- package/styles-g10.min.css +1 -1
- package/styles-g10.min.css.map +1 -1
- package/styles-g100.css +8 -0
- package/styles-g100.css.map +1 -1
- package/styles-g100.min.css +1 -1
- package/styles-g100.min.css.map +1 -1
- package/styles-g90.css +8 -0
- package/styles-g90.css.map +1 -1
- package/styles-g90.min.css +1 -1
- package/styles-g90.min.css.map +1 -1
- package/styles.css +8 -0
- package/styles.css.map +1 -1
- package/styles.min.css +1 -1
- package/styles.min.css.map +1 -1
- package/tools.d.ts +9 -0
- package/tools.js +32 -7
- package/tools.js.map +1 -1
- package/tsconfig.tsbuildinfo +87 -69
package/README.md
CHANGED
|
@@ -17,26 +17,36 @@ instead:
|
|
|
17
17
|
yarn add @carbon/charts d3
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
**Note:** you'd also need to install `carbon-components` if you're not using a
|
|
20
|
+
**Note:** you'd also need to install `carbon-components` if you're not using a
|
|
21
|
+
bundled version of the library.
|
|
21
22
|
|
|
22
23
|
## Step-by-step instructions
|
|
23
24
|
|
|
24
|
-
Read
|
|
25
|
+
Read
|
|
26
|
+
[here](https://carbon-design-system.github.io/carbon-charts/?path=/story/tutorials-getting-started--vanilla)
|
|
25
27
|
|
|
26
28
|
## Codesandbox examples
|
|
27
29
|
|
|
28
30
|
[Sample use cases can be seen here](https://carbon-design-system.github.io/carbon-charts).
|
|
29
31
|
|
|
30
|
-
**When opening the link above**, click on the **Edit on Codesandbox** button for
|
|
32
|
+
**When opening the link above**, click on the **Edit on Codesandbox** button for
|
|
33
|
+
each demo to see an isolated project showing you how to reproduce the demo.
|
|
31
34
|
|
|
32
35
|
## Charting data & options
|
|
33
36
|
|
|
34
|
-
Although we will definitely introduce new models in the future as we start
|
|
37
|
+
Although we will definitely introduce new models in the future as we start
|
|
38
|
+
shipping new components such as maps, Data and options follow the same model in
|
|
39
|
+
all charts, with minor exceptions and differences in specific components.
|
|
35
40
|
|
|
36
|
-
For instance in the case of a donut chart you're able to pass in an additional
|
|
41
|
+
For instance in the case of a donut chart you're able to pass in an additional
|
|
42
|
+
field called `center` in your options configuring the donut center.
|
|
37
43
|
|
|
38
|
-
For instructions on using the **tabular data format**, see
|
|
44
|
+
For instructions on using the **tabular data format**, see
|
|
45
|
+
[here](https://carbon-design-system.github.io/carbon-charts/?path=/story/tutorials--tabular-data-format)
|
|
39
46
|
|
|
40
|
-
There are also additional options available depending on the chart type being
|
|
47
|
+
There are also additional options available depending on the chart type being
|
|
48
|
+
used,
|
|
49
|
+
[see our demo examples here](https://github.com/carbon-design-system/carbon-charts/tree/master/packages/core/demo/data).
|
|
41
50
|
|
|
42
|
-
Customizable options (specific to chart type) can be found
|
|
51
|
+
Customizable options (specific to chart type) can be found
|
|
52
|
+
[here](https://carbon-design-system.github.io/carbon-charts/documentation/modules/_interfaces_charts_.html)
|
package/axis-chart.js
CHANGED
|
@@ -19,8 +19,8 @@ var __spreadArrays = (this && this.__spreadArrays) || function () {
|
|
|
19
19
|
return r;
|
|
20
20
|
};
|
|
21
21
|
import { Chart } from "./chart";
|
|
22
|
-
import { LayoutDirection, LayoutGrowth, LegendOrientations, LegendPositions
|
|
23
|
-
import { LayoutComponent, Legend, Title, Spacer
|
|
22
|
+
import { LayoutDirection, LayoutGrowth, LegendOrientations, LegendPositions } from "./interfaces/index";
|
|
23
|
+
import { LayoutComponent, Legend, Title, Spacer } from "./components/index";
|
|
24
24
|
import { Tools } from "./tools";
|
|
25
25
|
import { CartesianScales, Curves } from "./services/index";
|
|
26
26
|
var AxisChart = /** @class */ (function (_super) {
|
|
@@ -29,7 +29,7 @@ var AxisChart = /** @class */ (function (_super) {
|
|
|
29
29
|
var _this = _super.call(this, holder, chartConfigs) || this;
|
|
30
30
|
_this.services = Object.assign(_this.services, {
|
|
31
31
|
cartesianScales: CartesianScales,
|
|
32
|
-
curves: Curves
|
|
32
|
+
curves: Curves
|
|
33
33
|
});
|
|
34
34
|
return _this;
|
|
35
35
|
}
|
|
@@ -39,24 +39,24 @@ var AxisChart = /** @class */ (function (_super) {
|
|
|
39
39
|
components: [new Title(this.model, this.services)],
|
|
40
40
|
growth: {
|
|
41
41
|
x: LayoutGrowth.PREFERRED,
|
|
42
|
-
y: LayoutGrowth.FIXED
|
|
43
|
-
}
|
|
42
|
+
y: LayoutGrowth.FIXED
|
|
43
|
+
}
|
|
44
44
|
};
|
|
45
45
|
var legendComponent = {
|
|
46
46
|
id: "legend",
|
|
47
47
|
components: [new Legend(this.model, this.services)],
|
|
48
48
|
growth: {
|
|
49
49
|
x: LayoutGrowth.PREFERRED,
|
|
50
|
-
y: LayoutGrowth.FIXED
|
|
51
|
-
}
|
|
50
|
+
y: LayoutGrowth.FIXED
|
|
51
|
+
}
|
|
52
52
|
};
|
|
53
53
|
var graphFrameComponent = {
|
|
54
54
|
id: "graph-frame",
|
|
55
55
|
components: graphFrameComponents,
|
|
56
56
|
growth: {
|
|
57
57
|
x: LayoutGrowth.STRETCH,
|
|
58
|
-
y: LayoutGrowth.FIXED
|
|
59
|
-
}
|
|
58
|
+
y: LayoutGrowth.FIXED
|
|
59
|
+
}
|
|
60
60
|
};
|
|
61
61
|
var isLegendEnabled = this.model.getOptions().legend.enabled !== false;
|
|
62
62
|
// Decide the position of the legend in reference to the chart
|
|
@@ -86,23 +86,23 @@ var AxisChart = /** @class */ (function (_super) {
|
|
|
86
86
|
components: [new Spacer(this.model, this.services)],
|
|
87
87
|
growth: {
|
|
88
88
|
x: LayoutGrowth.PREFERRED,
|
|
89
|
-
y: LayoutGrowth.FIXED
|
|
90
|
-
}
|
|
89
|
+
y: LayoutGrowth.FIXED
|
|
90
|
+
}
|
|
91
91
|
};
|
|
92
92
|
var fullFrameComponent = {
|
|
93
93
|
id: "full-frame",
|
|
94
94
|
components: [
|
|
95
95
|
new LayoutComponent(this.model, this.services, __spreadArrays((isLegendEnabled ? [legendComponent] : []), [
|
|
96
96
|
legendSpacerComponent,
|
|
97
|
-
graphFrameComponent
|
|
97
|
+
graphFrameComponent
|
|
98
98
|
]), {
|
|
99
|
-
direction: fullFrameComponentDirection
|
|
100
|
-
})
|
|
99
|
+
direction: fullFrameComponentDirection
|
|
100
|
+
})
|
|
101
101
|
],
|
|
102
102
|
growth: {
|
|
103
103
|
x: LayoutGrowth.STRETCH,
|
|
104
|
-
y: LayoutGrowth.FIXED
|
|
105
|
-
}
|
|
104
|
+
y: LayoutGrowth.FIXED
|
|
105
|
+
}
|
|
106
106
|
};
|
|
107
107
|
// Add chart title if it exists
|
|
108
108
|
var topLevelLayoutComponents = [];
|
|
@@ -113,16 +113,16 @@ var AxisChart = /** @class */ (function (_super) {
|
|
|
113
113
|
components: [new Spacer(this.model, this.services)],
|
|
114
114
|
growth: {
|
|
115
115
|
x: LayoutGrowth.PREFERRED,
|
|
116
|
-
y: LayoutGrowth.FIXED
|
|
117
|
-
}
|
|
116
|
+
y: LayoutGrowth.FIXED
|
|
117
|
+
}
|
|
118
118
|
};
|
|
119
119
|
topLevelLayoutComponents.push(titleSpacerComponent);
|
|
120
120
|
}
|
|
121
121
|
topLevelLayoutComponents.push(fullFrameComponent);
|
|
122
122
|
return [
|
|
123
123
|
new LayoutComponent(this.model, this.services, topLevelLayoutComponents, {
|
|
124
|
-
direction: LayoutDirection.COLUMN
|
|
125
|
-
})
|
|
124
|
+
direction: LayoutDirection.COLUMN
|
|
125
|
+
})
|
|
126
126
|
];
|
|
127
127
|
};
|
|
128
128
|
return AxisChart;
|
package/axis-chart.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"axis-chart.js","sourceRoot":"","sources":["axis-chart.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EACN,eAAe,EACf,YAAY,EACZ,kBAAkB,EAClB,eAAe,
|
|
1
|
+
{"version":3,"file":"axis-chart.js","sourceRoot":"","sources":["axis-chart.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EACN,eAAe,EACf,YAAY,EACZ,kBAAkB,EAClB,eAAe,EAGf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,eAAe,EACf,MAAM,EACN,KAAK,EAGL,MAAM,EACN,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE3D;IAA+B,6BAAK;IAMnC,mBAAY,MAAe,EAAE,YAA2C;QAAxE,YACC,kBAAM,MAAM,EAAE,YAAY,CAAC,SAC3B;QAPD,cAAQ,GAAQ,MAAM,CAAC,MAAM,CAAC,KAAI,CAAC,QAAQ,EAAE;YAC5C,eAAe,EAAE,eAAe;YAChC,MAAM,EAAE,MAAM;SACd,CAAC,CAAC;;IAIH,CAAC;IAES,0CAAsB,GAAhC,UAAiC,oBAA2B;QAC3D,IAAM,cAAc,GAAG;YACtB,EAAE,EAAE,OAAO;YACX,UAAU,EAAE,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC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B,GAAG;gBAC5B,EAAE,EAAE,QAAQ;gBACZ,UAAU,EAAE,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;gBACnD,MAAM,EAAE;oBACP,CAAC,EAAE,YAAY,CAAC,SAAS;oBACzB,CAAC,EAAE,YAAY,CAAC,KAAK;iBACrB;aACD,CAAC;YAEF,wBAAwB,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;SACpD;QACD,wBAAwB,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;QAElD,OAAO;YACN,IAAI,eAAe,CAClB,IAAI,CAAC,KAAK,EACV,IAAI,CAAC,QAAQ,EACb,wBAAwB,EACxB;gBACC,SAAS,EAAE,eAAe,CAAC,MAAM;aACjC,CACD;SACD,CAAC;IACH,CAAC;IACF,gBAAC;AAAD,CAAC,AAhID,CAA+B,KAAK,GAgInC","sourcesContent":["import { Chart } from \"./chart\";\nimport {\n\tLayoutDirection,\n\tLayoutGrowth,\n\tLegendOrientations,\n\tLegendPositions,\n\tChartConfig,\n\tAxisChartOptions\n} from \"./interfaces/index\";\nimport {\n\tLayoutComponent,\n\tLegend,\n\tTitle,\n\tTooltip,\n\tTooltipBar,\n\tSpacer\n} from \"./components/index\";\nimport { Tools } from \"./tools\";\n\nimport { CartesianScales, Curves } from \"./services/index\";\n\nexport class AxisChart extends Chart {\n\tservices: any = Object.assign(this.services, {\n\t\tcartesianScales: CartesianScales,\n\t\tcurves: Curves\n\t});\n\n\tconstructor(holder: Element, chartConfigs: ChartConfig<AxisChartOptions>) {\n\t\tsuper(holder, chartConfigs);\n\t}\n\n\tprotected getAxisChartComponents(graphFrameComponents: any[]) {\n\t\tconst titleComponent = {\n\t\t\tid: \"title\",\n\t\t\tcomponents: [new Title(this.model, this.services)],\n\t\t\tgrowth: {\n\t\t\t\tx: LayoutGrowth.PREFERRED,\n\t\t\t\ty: LayoutGrowth.FIXED\n\t\t\t}\n\t\t};\n\n\t\tconst legendComponent = {\n\t\t\tid: \"legend\",\n\t\t\tcomponents: [new Legend(this.model, this.services)],\n\t\t\tgrowth: {\n\t\t\t\tx: LayoutGrowth.PREFERRED,\n\t\t\t\ty: LayoutGrowth.FIXED\n\t\t\t}\n\t\t};\n\n\t\tconst graphFrameComponent = {\n\t\t\tid: \"graph-frame\",\n\t\t\tcomponents: graphFrameComponents,\n\t\t\tgrowth: {\n\t\t\t\tx: LayoutGrowth.STRETCH,\n\t\t\t\ty: LayoutGrowth.FIXED\n\t\t\t}\n\t\t};\n\n\t\tconst isLegendEnabled =\n\t\t\tthis.model.getOptions().legend.enabled !== false;\n\n\t\t// Decide the position of the legend in reference to the chart\n\t\tlet fullFrameComponentDirection = LayoutDirection.COLUMN;\n\t\tif (isLegendEnabled) {\n\t\t\tconst legendPosition = Tools.getProperty(\n\t\t\t\tthis.model.getOptions(),\n\t\t\t\t\"legend\",\n\t\t\t\t\"position\"\n\t\t\t);\n\t\t\tif (legendPosition === LegendPositions.LEFT) {\n\t\t\t\tfullFrameComponentDirection = LayoutDirection.ROW;\n\n\t\t\t\tif (!this.model.getOptions().legend.orientation) {\n\t\t\t\t\tthis.model.getOptions().legend.orientation =\n\t\t\t\t\t\tLegendOrientations.VERTICAL;\n\t\t\t\t}\n\t\t\t} else if (legendPosition === LegendPositions.RIGHT) {\n\t\t\t\tfullFrameComponentDirection = LayoutDirection.ROW_REVERSE;\n\n\t\t\t\tif (!this.model.getOptions().legend.orientation) {\n\t\t\t\t\tthis.model.getOptions().legend.orientation =\n\t\t\t\t\t\tLegendOrientations.VERTICAL;\n\t\t\t\t}\n\t\t\t} else if (legendPosition === LegendPositions.BOTTOM) {\n\t\t\t\tfullFrameComponentDirection = LayoutDirection.COLUMN_REVERSE;\n\t\t\t}\n\t\t}\n\n\t\tconst legendSpacerComponent = {\n\t\t\tid: \"spacer\",\n\t\t\tcomponents: [new Spacer(this.model, this.services)],\n\t\t\tgrowth: {\n\t\t\t\tx: LayoutGrowth.PREFERRED,\n\t\t\t\ty: LayoutGrowth.FIXED\n\t\t\t}\n\t\t};\n\n\t\tconst fullFrameComponent = {\n\t\t\tid: \"full-frame\",\n\t\t\tcomponents: [\n\t\t\t\tnew LayoutComponent(\n\t\t\t\t\tthis.model,\n\t\t\t\t\tthis.services,\n\t\t\t\t\t[\n\t\t\t\t\t\t...(isLegendEnabled ? [legendComponent] : []),\n\t\t\t\t\t\tlegendSpacerComponent,\n\t\t\t\t\t\tgraphFrameComponent\n\t\t\t\t\t],\n\t\t\t\t\t{\n\t\t\t\t\t\tdirection: fullFrameComponentDirection\n\t\t\t\t\t}\n\t\t\t\t)\n\t\t\t],\n\t\t\tgrowth: {\n\t\t\t\tx: LayoutGrowth.STRETCH,\n\t\t\t\ty: LayoutGrowth.FIXED\n\t\t\t}\n\t\t};\n\n\t\t// Add chart title if it exists\n\t\tconst topLevelLayoutComponents = [];\n\t\tif (this.model.getOptions().title) {\n\t\t\ttopLevelLayoutComponents.push(titleComponent);\n\n\t\t\tconst titleSpacerComponent = {\n\t\t\t\tid: \"spacer\",\n\t\t\t\tcomponents: [new Spacer(this.model, this.services)],\n\t\t\t\tgrowth: {\n\t\t\t\t\tx: LayoutGrowth.PREFERRED,\n\t\t\t\t\ty: LayoutGrowth.FIXED\n\t\t\t\t}\n\t\t\t};\n\n\t\t\ttopLevelLayoutComponents.push(titleSpacerComponent);\n\t\t}\n\t\ttopLevelLayoutComponents.push(fullFrameComponent);\n\n\t\treturn [\n\t\t\tnew LayoutComponent(\n\t\t\t\tthis.model,\n\t\t\t\tthis.services,\n\t\t\t\ttopLevelLayoutComponents,\n\t\t\t\t{\n\t\t\t\t\tdirection: LayoutDirection.COLUMN\n\t\t\t\t}\n\t\t\t)\n\t\t];\n\t}\n}\n"]}
|
|
@@ -55,6 +55,23 @@ export declare const stackedAreaTimeSeriesOptions: {
|
|
|
55
55
|
};
|
|
56
56
|
curve: string;
|
|
57
57
|
};
|
|
58
|
+
export declare const stackedAreaTimeSeriesUnevenData: {
|
|
59
|
+
group: string;
|
|
60
|
+
date: Date;
|
|
61
|
+
value: number;
|
|
62
|
+
}[];
|
|
63
|
+
export declare const stackedAreaTimeSeriesUnevenDataOptions: {
|
|
64
|
+
title: string;
|
|
65
|
+
axes: {
|
|
66
|
+
left: {
|
|
67
|
+
stacked: boolean;
|
|
68
|
+
};
|
|
69
|
+
bottom: {
|
|
70
|
+
scaleType: string;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
curve: string;
|
|
74
|
+
};
|
|
58
75
|
export declare const stackedAreaPercentageTimeSeriesOptions: {
|
|
59
76
|
title: string;
|
|
60
77
|
axes: {
|
package/build/demo/data/bar.d.ts
CHANGED
|
@@ -15,6 +15,26 @@ export declare const groupedBarOptions: {
|
|
|
15
15
|
};
|
|
16
16
|
};
|
|
17
17
|
};
|
|
18
|
+
export declare const groupedBarSelectedGroupsData: {
|
|
19
|
+
group: string;
|
|
20
|
+
key: string;
|
|
21
|
+
value: number;
|
|
22
|
+
}[];
|
|
23
|
+
export declare const groupedBarSelectedGroupsOptions: {
|
|
24
|
+
title: string;
|
|
25
|
+
data: {
|
|
26
|
+
selectedGroups: string[];
|
|
27
|
+
};
|
|
28
|
+
axes: {
|
|
29
|
+
left: {
|
|
30
|
+
mapsTo: string;
|
|
31
|
+
};
|
|
32
|
+
bottom: {
|
|
33
|
+
scaleType: string;
|
|
34
|
+
mapsTo: string;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
};
|
|
18
38
|
export declare const groupedHorizontalBarData: {
|
|
19
39
|
group: string;
|
|
20
40
|
key: string;
|
|
@@ -48,6 +68,29 @@ export declare const simpleBarOptions: {
|
|
|
48
68
|
};
|
|
49
69
|
};
|
|
50
70
|
};
|
|
71
|
+
export declare const simpleBarLongLabelData: {
|
|
72
|
+
group: string;
|
|
73
|
+
value: number;
|
|
74
|
+
}[];
|
|
75
|
+
export declare const simpleBarLongLabelOptions: {
|
|
76
|
+
title: string;
|
|
77
|
+
axes: {
|
|
78
|
+
left: {
|
|
79
|
+
mapsTo: string;
|
|
80
|
+
};
|
|
81
|
+
bottom: {
|
|
82
|
+
mapsTo: string;
|
|
83
|
+
scaleType: string;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
legend: {
|
|
87
|
+
truncation: {
|
|
88
|
+
type: string;
|
|
89
|
+
threshold: number;
|
|
90
|
+
numCharacter: number;
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
};
|
|
51
94
|
export declare const simpleBarFixedDomainOptions: {
|
|
52
95
|
title: string;
|
|
53
96
|
axes: {
|
|
@@ -65,6 +108,10 @@ export declare const simpleHorizontalBarData: {
|
|
|
65
108
|
group: string;
|
|
66
109
|
value: number;
|
|
67
110
|
}[];
|
|
111
|
+
export declare const simpleHorizontalBarLongLabelData: {
|
|
112
|
+
group: string;
|
|
113
|
+
value: number;
|
|
114
|
+
}[];
|
|
68
115
|
export declare const simpleHorizontalBarOptions: {
|
|
69
116
|
title: string;
|
|
70
117
|
axes: {
|
|
@@ -77,6 +124,30 @@ export declare const simpleHorizontalBarOptions: {
|
|
|
77
124
|
};
|
|
78
125
|
};
|
|
79
126
|
};
|
|
127
|
+
export declare const simpleHorizontalBarLongLabelOptions: {
|
|
128
|
+
title: string;
|
|
129
|
+
axes: {
|
|
130
|
+
left: {
|
|
131
|
+
mapsTo: string;
|
|
132
|
+
scaleType: string;
|
|
133
|
+
truncation: {
|
|
134
|
+
type: string;
|
|
135
|
+
threshold: number;
|
|
136
|
+
numCharacter: number;
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
bottom: {
|
|
140
|
+
mapsTo: string;
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
legend: {
|
|
144
|
+
truncation: {
|
|
145
|
+
type: string;
|
|
146
|
+
threshold: number;
|
|
147
|
+
numCharacter: number;
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
};
|
|
80
151
|
export declare const simpleBarTimeSeriesData: {
|
|
81
152
|
group: string;
|
|
82
153
|
date: Date;
|
|
@@ -24,6 +24,32 @@ export declare const lineOptions: {
|
|
|
24
24
|
};
|
|
25
25
|
};
|
|
26
26
|
};
|
|
27
|
+
export declare const lineLongLabelData: ({
|
|
28
|
+
group: string;
|
|
29
|
+
key: string;
|
|
30
|
+
value: number;
|
|
31
|
+
audienceSize?: undefined;
|
|
32
|
+
} | {
|
|
33
|
+
group: string;
|
|
34
|
+
key: string;
|
|
35
|
+
value: number;
|
|
36
|
+
audienceSize: number;
|
|
37
|
+
})[];
|
|
38
|
+
export declare const lineLongLabelOptions: {
|
|
39
|
+
title: string;
|
|
40
|
+
axes: {
|
|
41
|
+
bottom: {
|
|
42
|
+
title: string;
|
|
43
|
+
mapsTo: string;
|
|
44
|
+
scaleType: string;
|
|
45
|
+
};
|
|
46
|
+
left: {
|
|
47
|
+
mapsTo: string;
|
|
48
|
+
title: string;
|
|
49
|
+
scaleType: string;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
};
|
|
27
53
|
export declare const lineCustomDomainOptions: {
|
|
28
54
|
title: string;
|
|
29
55
|
axes: {
|
|
@@ -41,6 +67,35 @@ export declare const lineCustomDomainOptions: {
|
|
|
41
67
|
};
|
|
42
68
|
};
|
|
43
69
|
};
|
|
70
|
+
export declare const lineSelectedGroupsData: ({
|
|
71
|
+
group: string;
|
|
72
|
+
key: string;
|
|
73
|
+
value: number;
|
|
74
|
+
audienceSize?: undefined;
|
|
75
|
+
} | {
|
|
76
|
+
group: string;
|
|
77
|
+
key: string;
|
|
78
|
+
value: number;
|
|
79
|
+
audienceSize: number;
|
|
80
|
+
})[];
|
|
81
|
+
export declare const lineSelectedGroupsOptions: {
|
|
82
|
+
title: string;
|
|
83
|
+
data: {
|
|
84
|
+
selectedGroups: string[];
|
|
85
|
+
};
|
|
86
|
+
axes: {
|
|
87
|
+
bottom: {
|
|
88
|
+
title: string;
|
|
89
|
+
mapsTo: string;
|
|
90
|
+
scaleType: string;
|
|
91
|
+
};
|
|
92
|
+
left: {
|
|
93
|
+
mapsTo: string;
|
|
94
|
+
title: string;
|
|
95
|
+
scaleType: string;
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
};
|
|
44
99
|
export declare const lineTimeSeriesData: {
|
|
45
100
|
group: string;
|
|
46
101
|
date: Date;
|
|
@@ -36,6 +36,24 @@ export declare const scatterDiscreteOptions: {
|
|
|
36
36
|
};
|
|
37
37
|
};
|
|
38
38
|
};
|
|
39
|
+
export declare const scatterLongLabelDiscreteData: {
|
|
40
|
+
group: string;
|
|
41
|
+
key: string;
|
|
42
|
+
value: number;
|
|
43
|
+
}[];
|
|
44
|
+
export declare const scatterLongLabelDiscreteOptions: {
|
|
45
|
+
title: string;
|
|
46
|
+
axes: {
|
|
47
|
+
bottom: {
|
|
48
|
+
title: string;
|
|
49
|
+
scaleType: string;
|
|
50
|
+
mapsTo: string;
|
|
51
|
+
};
|
|
52
|
+
left: {
|
|
53
|
+
mapsTo: string;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
};
|
|
39
57
|
export declare const scatterTimeSeriesData: {
|
|
40
58
|
group: string;
|
|
41
59
|
date: Date;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Tooltip } from "./tooltip";
|
|
2
|
-
import { TooltipPosition } from "./../../interfaces";
|
|
2
|
+
import { TooltipPosition, TooltipTypes } from "./../../interfaces";
|
|
3
3
|
export declare class TooltipBar extends Tooltip {
|
|
4
4
|
init(): void;
|
|
5
5
|
/**
|
|
@@ -18,7 +18,7 @@ export declare class TooltipBar extends Tooltip {
|
|
|
18
18
|
* Returns the html for the bar single point tooltip
|
|
19
19
|
* @param data associated values for the hovered bar
|
|
20
20
|
*/
|
|
21
|
-
getTooltipHTML(data: any): string;
|
|
21
|
+
getTooltipHTML(data: any, type: TooltipTypes): string;
|
|
22
22
|
/**
|
|
23
23
|
* Multip tooltips for bar charts include totals for each stack
|
|
24
24
|
* @param data
|
|
@@ -9,9 +9,9 @@ export declare class Tooltip extends Component {
|
|
|
9
9
|
constructor(model: ChartModel, services: any, configs?: any);
|
|
10
10
|
init(): void;
|
|
11
11
|
getTooltipHTML(data: any, type: TooltipTypes): string;
|
|
12
|
-
getMultilineTooltipHTML(data: any): string;
|
|
12
|
+
getMultilineTooltipHTML(data: any, type: TooltipTypes): string;
|
|
13
13
|
render(): void;
|
|
14
|
-
getTooltipPosition(hoveredElement: any): {
|
|
14
|
+
getTooltipPosition(hoveredElement: any, type: TooltipTypes): {
|
|
15
15
|
placement: TooltipPosition;
|
|
16
16
|
position: {
|
|
17
17
|
left: number;
|
|
@@ -2,6 +2,7 @@ import { ScaleTypes } from "./enums";
|
|
|
2
2
|
import { AxisDomain } from "d3";
|
|
3
3
|
import { Locale } from "date-fns";
|
|
4
4
|
import { ThresholdOptions } from "./components";
|
|
5
|
+
import { TruncationOptions } from "./truncation";
|
|
5
6
|
/**
|
|
6
7
|
* options to configure a scale. not all options are used by all scales
|
|
7
8
|
*/
|
|
@@ -77,6 +78,7 @@ export interface AxisOptions {
|
|
|
77
78
|
*/
|
|
78
79
|
formatter?: Function;
|
|
79
80
|
};
|
|
81
|
+
truncation?: TruncationOptions;
|
|
80
82
|
}
|
|
81
83
|
/**
|
|
82
84
|
* customize time series scales
|
|
@@ -67,6 +67,11 @@ export interface BaseChartOptions {
|
|
|
67
67
|
* used to simulate data loading
|
|
68
68
|
*/
|
|
69
69
|
loading?: Boolean;
|
|
70
|
+
/**
|
|
71
|
+
* options related to pre-selected data groups
|
|
72
|
+
* Remains empty if every legend item is active or dataset doesn't have the data groups.
|
|
73
|
+
*/
|
|
74
|
+
selectedGroups?: string[];
|
|
70
75
|
};
|
|
71
76
|
/**
|
|
72
77
|
* options related to color scales
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { LayoutGrowth, LegendPositions } from "./enums";
|
|
2
2
|
import { Component } from "../components/component";
|
|
3
|
+
import { TruncationOptions } from "./truncation";
|
|
3
4
|
/**
|
|
4
5
|
* customize the overlay contents
|
|
5
6
|
*/
|
|
@@ -47,6 +48,7 @@ export interface LegendOptions {
|
|
|
47
48
|
radius?: Number;
|
|
48
49
|
spaceAfter?: Number;
|
|
49
50
|
};
|
|
51
|
+
truncation?: TruncationOptions;
|
|
50
52
|
}
|
|
51
53
|
export interface TooltipOptions {
|
|
52
54
|
/**
|
|
@@ -18,6 +18,15 @@ export declare enum AxisPositions {
|
|
|
18
18
|
TOP = "top",
|
|
19
19
|
BOTTOM = "bottom"
|
|
20
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* enum of all possible truncation types
|
|
23
|
+
*/
|
|
24
|
+
export declare enum TruncationTypes {
|
|
25
|
+
END_LINE = "end_line",
|
|
26
|
+
MID_LINE = "mid_line",
|
|
27
|
+
FRONT_LINE = "front_line",
|
|
28
|
+
NONE = "none"
|
|
29
|
+
}
|
|
21
30
|
/**
|
|
22
31
|
* enum of all possible cartesian orientations
|
|
23
32
|
* to be used for determining the orientation
|
|
@@ -51,7 +60,9 @@ export declare enum TooltipPosition {
|
|
|
51
60
|
export declare enum TooltipTypes {
|
|
52
61
|
DATAPOINT = "datapoint",
|
|
53
62
|
GRIDLINE = "gridline",
|
|
54
|
-
TITLE = "title"
|
|
63
|
+
TITLE = "title",
|
|
64
|
+
LEGEND = "legend",
|
|
65
|
+
AXISLABEL = "axislabel"
|
|
55
66
|
}
|
|
56
67
|
/**
|
|
57
68
|
* enum of all possible legend positions
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface TruncationOptions {
|
|
2
|
+
/**
|
|
3
|
+
* truncation configuration
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* truncation type
|
|
7
|
+
*/
|
|
8
|
+
type?: string;
|
|
9
|
+
/**
|
|
10
|
+
* truncation threshold
|
|
11
|
+
*/
|
|
12
|
+
threshold?: Number;
|
|
13
|
+
/**
|
|
14
|
+
* how many characters to be shown
|
|
15
|
+
*/
|
|
16
|
+
numCharacter?: Number;
|
|
17
|
+
}
|
package/build/src/model.d.ts
CHANGED
package/build/src/tools.d.ts
CHANGED
|
@@ -82,6 +82,15 @@ export declare namespace Tools {
|
|
|
82
82
|
* @returns The percentage in the form of a number (1 significant digit if necessary)
|
|
83
83
|
*/
|
|
84
84
|
export function convertValueToPercentage(item: any, fullData: any): number;
|
|
85
|
+
/**
|
|
86
|
+
* Truncate the labels
|
|
87
|
+
* @export
|
|
88
|
+
* @param {any} fullText
|
|
89
|
+
* @param {any} truncationType
|
|
90
|
+
* @param {any} numCharacter
|
|
91
|
+
* @returns Truncated text
|
|
92
|
+
*/
|
|
93
|
+
export function truncateLabel(fullText: any, truncationType: any, numCharacter: any): any;
|
|
85
94
|
/**************************************
|
|
86
95
|
* Object/array related checks *
|
|
87
96
|
*************************************/
|