@carbon/charts 1.6.14 → 1.7.1
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 +22 -0
- package/build/src/components/diagrams/buildPaths.d.ts +27 -3
- package/build/src/components/graphs/bubble.d.ts +1 -1
- package/build/src/components/graphs/wordcloud.d.ts +1 -1
- package/build/src/interfaces/charts.d.ts +6 -0
- package/bundle.js +3 -1
- package/components/essentials/threshold.js +2 -0
- package/components/essentials/threshold.js.map +1 -1
- package/components/essentials/tooltip.js +2 -0
- package/components/essentials/tooltip.js.map +1 -1
- package/components/graphs/bubble.d.ts +1 -1
- package/components/graphs/wordcloud.d.ts +1 -1
- package/demo/data/bar.js +60 -12
- package/demo/data/bar.js.map +1 -1
- package/demo/data/bundle.js +1 -1
- package/demo/styles.css +5813 -3083
- 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 +758 -1538
- package/interfaces/charts.d.ts +6 -0
- package/interfaces/charts.js.map +1 -1
- package/model/model.js +7 -1
- package/model/model.js.map +1 -1
- package/package.json +15 -14
- package/services/essentials/dom-utils.js +15 -3
- package/services/essentials/dom-utils.js.map +1 -1
- package/styles.css +89 -37
- package/styles.css.map +1 -1
- package/styles.min.css +1 -1
- package/styles.min.css.map +1 -1
- package/tsconfig.tsbuildinfo +829 -2099
- package/services/essentials/dom-to-image.d.ts +0 -120
- package/services/essentials/dom-to-image.js +0 -720
- package/services/essentials/dom-to-image.js.map +0 -1
package/interfaces/charts.d.ts
CHANGED
|
@@ -113,6 +113,12 @@ export interface BaseChartOptions {
|
|
|
113
113
|
colors?: Array<String>;
|
|
114
114
|
};
|
|
115
115
|
};
|
|
116
|
+
fileDownload?: {
|
|
117
|
+
/**
|
|
118
|
+
* the number of color variants in the palette (defaults to using the number of data groups in the given data)
|
|
119
|
+
*/
|
|
120
|
+
fileName?: (type: 'png' | 'jpg' | 'csv') => string;
|
|
121
|
+
};
|
|
116
122
|
}
|
|
117
123
|
/**
|
|
118
124
|
* Options common to any chart with an axis
|
package/interfaces/charts.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"charts.js","sourceRoot":"","sources":["charts.ts"],"names":[],"mappings":"","sourcesContent":["import {\n\tGaugeTypes,\n\tStatuses,\n\tArrowDirections,\n\tAlignments,\n\tChartTypes,\n\tTreeTypes,\n\tDividerStatus,\n\tColorLegendType,\n\tChartTheme,\n} from './enums';\nimport {\n\tLegendOptions,\n\tTooltipOptions,\n\tGridOptions,\n\tAxesOptions,\n\tZoomBarsOptions,\n} from './index';\nimport { BarOptions, StackedBarOptions, ToolbarOptions } from './components';\nimport {\n\tAxisOptions,\n\tBinnedAxisOptions,\n\tComboChartAxisOptions,\n\tTimeScaleOptions,\n} from './axis-scales';\n\n/**\n * Base chart options common to any chart\n */\nexport interface BaseChartOptions {\n\t/**\n\t * Optionally specify a title for the chart\n\t */\n\ttitle?: string;\n\t/**\n\t * boolean to disable animations (enabled by default)\n\t */\n\tanimations?: boolean;\n\t/**\n\t * boolean to prevent the container from resizing\n\t */\n\tresizable?: boolean;\n\t/**\n\t * Optionally specify a width for the chart\n\t */\n\twidth?: string;\n\t/**\n\t * Optionally specify a height for the chart\n\t */\n\theight?: string;\n\t/**\n\t * Optionally specify a theme for the chart\n\t */\n\ttheme?: ChartTheme;\n\t/**\n\t * tooltip configuration\n\t */\n\ttooltip?: TooltipOptions;\n\t/**\n\t * legend configuration\n\t */\n\tlegend?: LegendOptions;\n\t/**\n\t * toolbar configurations\n\t */\n\ttoolbar?: ToolbarOptions;\n\t/**\n\t * Optional function to determine whether is filled based on datasetLabel, label, and/or data\n\t */\n\tgetIsFilled?: (\n\t\tdatasetLabel: any,\n\t\tlabel?: any,\n\t\tdata?: any,\n\t\tdefaultFilled?: boolean\n\t) => boolean;\n\t/**\n\t * Optional function to generate the fill color based on datasetLabel, label, and/or data\n\t */\n\tgetFillColor?: (\n\t\tgroup: string,\n\t\tlabel?: string,\n\t\tdata?: any,\n\t\tdefaultFillColor?: string\n\t) => string;\n\t/**\n\t * Optional function to generate the stroke color based on datasetLabel, label, and/or data\n\t * (note) - not all chart types support the stroke color (e.g. wordcloud)\n\t */\n\tgetStrokeColor?: (\n\t\tgroup: string,\n\t\tlabel?: any,\n\t\tdata?: any,\n\t\tdefaultStrokeColor?: string\n\t) => string;\n\t/**\n\t * stylesheet options\n\t */\n\tstyle?: {\n\t\t/**\n\t\t * optional prefixing string for css classes (defaults to 'cc')\n\t\t */\n\t\tprefix?: string;\n\t};\n\t/**\n\t * options related to charting data\n\t */\n\tdata?: {\n\t\t/**\n\t\t * identifier for data groups\n\t\t */\n\t\tgroupMapsTo?: string;\n\t\t/**\n\t\t * used to simulate data loading in skeleton way\n\t\t */\n\t\tloading?: boolean;\n\t\t/**\n\t\t * options related to pre-selected data groups\n\t\t * Remains empty if every legend item is active or dataset doesn't have the data groups.\n\t\t */\n\t\tselectedGroups?: string[];\n\t};\n\t/**\n\t * options related to color scales\n\t */\n\tcolor?: {\n\t\t/**\n\t\t * e.g. { 'Dataset 1': 'blue' }\n\t\t */\n\t\tscale?: object;\n\t\t/**\n\t\t * use a carbon dataviz preset color palette\n\t\t * put the index (selection of which variant)\n\t\t */\n\t\tpairing?: {\n\t\t\t/**\n\t\t\t * the number of color variants in the palette (defaults to using the number of data groups in the given data)\n\t\t\t */\n\t\t\tnumberOfVariants?: number;\n\t\t\t/**\n\t\t\t * the option number of the color paring\n\t\t\t */\n\t\t\toption?: number;\n\t\t};\n\t\t/*\n\t\t * options related to gradient\n\t\t * e.g. { enabled: true }\n\t\t */\n\t\tgradient?: {\n\t\t\tenabled?: boolean;\n\t\t\t/**\n\t\t\t * hex color array\n\t\t\t * e.g. ['#fff', '#000', ...]\n\t\t\t */\n\t\t\tcolors?: Array<String>;\n\t\t};\n\t};\n}\n\n/**\n * Options common to any chart with an axis\n */\nexport interface AxisChartOptions extends BaseChartOptions {\n\taxes?: AxesOptions<AxisOptions>;\n\tgrid?: GridOptions;\n\ttimeScale?: TimeScaleOptions;\n\t/**\n\t * zoombar configuration\n\t */\n\tzoomBar?: ZoomBarsOptions;\n}\n\n/**\n * Options common to binned charts with an axis\n */\nexport interface BinnedAxisChartOptions extends AxisChartOptions {\n\taxes?: AxesOptions<BinnedAxisOptions>;\n\tgrid?: GridOptions;\n\ttimeScale?: TimeScaleOptions;\n\t/**\n\t * zoombar configuration\n\t */\n\tzoomBar?: ZoomBarsOptions;\n}\n\n/**\n * options specific to boxplot charts\n */\nexport interface BoxplotChartOptions extends AxisChartOptions {}\n\n/**\n * options specific to bar charts\n */\nexport interface BarChartOptions extends AxisChartOptions {\n\tbars?: BarOptions;\n}\n\n/**\n * options specific to stacked bar charts\n */\nexport interface StackedBarChartOptions extends BarChartOptions {\n\tbars?: StackedBarOptions;\n}\n\n/**\n * options specific to scatter charts\n */\nexport interface ScatterChartOptions extends AxisChartOptions {\n\t/**\n\t * options for the points\n\t */\n\tpoints?: {\n\t\t/**\n\t\t * sets the radius of the point\n\t\t */\n\t\tradius: number;\n\t\tfillOpacity?: number;\n\t\tfilled?: boolean;\n\t\tenabled?: boolean;\n\t};\n}\n\n/**\n * options specific to lollipop charts\n */\nexport interface LollipopChartOptions extends ScatterChartOptions {}\n\n/**\n * options specific to bubble charts\n */\nexport interface BubbleChartOptions extends AxisChartOptions {\n\t/**\n\t * options for the individual bubbles\n\t */\n\tbubble?: {\n\t\t/**\n\t\t * the key to lookup in charting data for the bubble radius value\n\t\t */\n\t\tradiusMapsTo?: string;\n\t\t/**\n\t\t * options for what the bubble radius value maps to\n\t\t */\n\t\tradiusLabel?: string;\n\t\t/**\n\t\t * A function that would determine the range of the bubble radius to use\n\t\t * Returns an array with the 1st value being the min and the 2nd value being the max radius\n\t\t */\n\t\tradiusRange?: Function;\n\t\t/**\n\t\t * Opacity of the fills used within each circle\n\t\t */\n\t\tfillOpacity?: number;\n\t\t/**\n\t\t * enabled scatter dot or not\n\t\t */\n\t\tenabled?: boolean;\n\t};\n}\n\n/**\n * options specific to bullet charts\n */\nexport interface BulletChartOptions extends AxisChartOptions {\n\t/**\n\t * options for the individual bullets\n\t */\n\tbullet?: {\n\t\tperformanceAreaTitles?: string[];\n\t};\n}\n\n/**\n * options specific to histogram charts\n */\nexport interface HistogramChartOptions extends AxisChartOptions {\n\t/**\n\t * options related to bins\n\t */\n\tbins?: {\n\t\trangeLabel?: string;\n\t};\n}\n\n/**\n * options specific to line charts\n */\nexport interface LineChartOptions extends ScatterChartOptions {\n\t/**\n\t * options for the curve of the line\n\t */\n\tcurve?: string | { name: string };\n}\n\n/**\n * options specific to area charts\n */\nexport interface AreaChartOptions extends AxisChartOptions {\n\t/**\n\t * options for the curve of the line\n\t */\n\tcurve?: string | { name: string };\n\t/**\n\t * options to bound the area of the chart\n\t */\n\tbounds?: {\n\t\tupperBoundMapsTo?: string;\n\t\tlowerBoundMapsTo?: string;\n\t};\n}\n\n/**\n * options specific to area charts\n */\nexport interface StackedAreaChartOptions extends ScatterChartOptions {\n\t/**\n\t * options for the curve of the line\n\t */\n\tcurve?: string | { name: string };\n}\n\n/**\n * options specific to world cloud charts\n */\nexport interface WordCloudChartTooltipOptions extends TooltipOptions {\n\t/** the label that shows up by the highlighted word in the tooltip */\n\twordLabel?: string;\n\t/** the label that shows up by the value of the highlighted word in the tooltip */\n\tvalueLabel?: string;\n}\n\nexport interface WorldCloudChartOptions extends BaseChartOptions {\n\twordCloud?: {\n\t\t/** what key in your charting data will the font sizes map to? */\n\t\tfontSizeMapsTo?: string;\n\t\t/** a function (chartSize, data) => {} that'll decide the range of font sizes, e.g. [10, 80] */\n\t\tfontSizeRange?: Function;\n\t\t/** what key in your charting data will the words map to? */\n\t\twordMapsTo?: string;\n\t};\n\t/**\n\t * tooltip configuration\n\t */\n\ttooltip?: WordCloudChartTooltipOptions;\n}\n\n/**\n * options specific to pie charts\n */\nexport interface PieChartOptions extends BaseChartOptions {\n\tpie?: {\n\t\tlabels?: {\n\t\t\tformatter?: Function;\n\t\t\tenabled?: Boolean;\n\t\t};\n\t\talignment?: Alignments;\n\t\t/**\n\t\t * identifier for value key in your charting data\n\t\t * defaults to value\n\t\t */\n\t\tvalueMapsTo?: string;\n\t\tsortFunction?: (a: any, b: any) => number;\n\t};\n}\n\n/**\n * options specific to gauge charts\n */\nexport interface GaugeChartOptions extends BaseChartOptions {\n\tgauge?: {\n\t\tarcWidth?: number;\n\t\tdeltaArrow?: {\n\t\t\tdirection?: ArrowDirections;\n\t\t\tsize?: Function;\n\t\t\tenabled: Boolean;\n\t\t};\n\t\tshowPercentageSymbol?: Boolean;\n\t\tstatus?: Statuses;\n\t\tdeltaFontSize?: Function;\n\t\tnumberSpacing?: number;\n\t\tnumberFormatter?: Function;\n\t\tvalueFontSize?: Function;\n\t\ttype?: GaugeTypes;\n\t\talignment?: Alignments;\n\t};\n}\n\n/**\n * options specific to donut charts\n */\nexport interface DonutChartOptions extends PieChartOptions {\n\tdonut?: {\n\t\tcenter?: {\n\t\t\tlabel?: string;\n\t\t\tnumber?: number;\n\t\t\tnumberFontSize?: Function;\n\t\t\ttitleFontSize?: Function;\n\t\t\ttitleYPosition?: Function;\n\t\t\tnumberFormatter?: Function;\n\t\t};\n\t\talignment?: Alignments;\n\t};\n}\n\nexport interface MeterChartOptions extends BaseChartOptions {\n\tmeter?: {\n\t\tshowLabels?: boolean;\n\t\tproportional?: {\n\t\t\ttotal?: number;\n\t\t\tunit?: string;\n\t\t};\n\t\tpeak?: number;\n\t\tstatus?: {\n\t\t\tranges: Array<{\n\t\t\t\trange: [number, number];\n\t\t\t\tstatus: Statuses;\n\t\t\t}>;\n\t\t};\n\t\theight?: number;\n\t\ttitle?: {\n\t\t\tpercentageIndicator?: {\n\t\t\t\t/**\n\t\t\t\t * rendering of the percentage value relative to the dataset within title\n\t\t\t\t */\n\t\t\t\tenabled?: boolean;\n\t\t\t};\n\t\t};\n\t};\n}\n\nexport interface ProportionalMeterChartOptions extends BaseChartOptions {\n\tmeter?: {\n\t\tproportional?: {\n\t\t\ttotal?: number;\n\t\t\tunit?: string;\n\t\t};\n\t};\n}\n\n/**\n * options specific to radar charts\n */\nexport interface RadarChartOptions extends BaseChartOptions {\n\tradar?: {\n\t\taxes: {\n\t\t\tangle: string;\n\t\t\tvalue: string;\n\t\t};\n\t\talignment?: Alignments;\n\t};\n}\n\n/**\n * options specific to combo charts\n */\nexport interface ComboChartOptions extends AxisChartOptions {\n\taxes?: AxesOptions<ComboChartAxisOptions>;\n\tcomboChartTypes: Array<{\n\t\ttype: ChartTypes | any;\n\t\toptions?: object;\n\t\tcorrespondingDatasets: Array<string>;\n\t}>;\n}\n\n/*\n * options specific to treemap charts\n */\nexport interface TreemapChartOptions extends BaseChartOptions {}\n\n/*\n * options specific to tree charts\n */\nexport interface TreeChartOptions extends BaseChartOptions {\n\ttree?: {\n\t\ttype?: TreeTypes;\n\t\trootTitle?: string;\n\t};\n}\n\n/*\n * options specific to circle pack charts\n */\nexport interface CirclePackChartOptions extends BaseChartOptions {\n\tcirclePack?: {\n\t\tcircles: {\n\t\t\tfillOpacity: number;\n\t\t};\n\t\t// depth of nodes to display\n\t\thierachyLevel: number;\n\t\tpadding?: {\n\t\t\touter?: number;\n\t\t\tinner?: number;\n\t\t};\n\t};\n}\n\n/**\n * options specific to Alluvial charts\n */\nexport interface AlluvialChartOptions extends BaseChartOptions {\n\talluvial: {\n\t\tunits?: string;\n\t\t/**\n\t\t * List of nodes to draw\n\t\t */\n\t\tnodes: Array<{\n\t\t\tname: string;\n\t\t\tcategory?: string;\n\t\t}>;\n\t\t/**\n\t\t * Node alignment (Default is center)\n\t\t */\n\t\tnodeAlignment?: Alignments;\n\t\t/**\n\t\t * Set the node padding\n\t\t */\n\t\tnodePadding?: number;\n\t\t/**\n\t\t * Enable single color usage for lines\n\t\t */\n\t\tmonochrome?: boolean;\n\t};\n}\n\n/**\n * options specific to Heatmap charts\n */\nexport interface HeatmapChartOptions extends BaseChartOptions {\n\theatmap: {\n\t\t/**\n\t\t * Divider width state - will default to auto\n\t\t * No cell divider for cell dimensions less than 16\n\t\t */\n\t\tdivider?: {\n\t\t\tstate?: DividerStatus;\n\t\t};\n\t\t/**\n\t\t * customize color legend\n\t\t * enabled by default on select charts\n\t\t */\n\t\tcolorLegend?: {\n\t\t\t/**\n\t\t\t * Text to display beside or on top of the legend\n\t\t\t * Position is determined by text length\n\t\t\t */\n\t\t\ttitle?: string;\n\t\t\ttype: ColorLegendType;\n\t\t};\n\t};\n}\n"]}
|
|
1
|
+
{"version":3,"file":"charts.js","sourceRoot":"","sources":["charts.ts"],"names":[],"mappings":"","sourcesContent":["import {\n\tGaugeTypes,\n\tStatuses,\n\tArrowDirections,\n\tAlignments,\n\tChartTypes,\n\tTreeTypes,\n\tDividerStatus,\n\tColorLegendType,\n\tChartTheme,\n} from './enums';\nimport {\n\tLegendOptions,\n\tTooltipOptions,\n\tGridOptions,\n\tAxesOptions,\n\tZoomBarsOptions,\n} from './index';\nimport { BarOptions, StackedBarOptions, ToolbarOptions } from './components';\nimport {\n\tAxisOptions,\n\tBinnedAxisOptions,\n\tComboChartAxisOptions,\n\tTimeScaleOptions,\n} from './axis-scales';\n\n/**\n * Base chart options common to any chart\n */\nexport interface BaseChartOptions {\n\t/**\n\t * Optionally specify a title for the chart\n\t */\n\ttitle?: string;\n\t/**\n\t * boolean to disable animations (enabled by default)\n\t */\n\tanimations?: boolean;\n\t/**\n\t * boolean to prevent the container from resizing\n\t */\n\tresizable?: boolean;\n\t/**\n\t * Optionally specify a width for the chart\n\t */\n\twidth?: string;\n\t/**\n\t * Optionally specify a height for the chart\n\t */\n\theight?: string;\n\t/**\n\t * Optionally specify a theme for the chart\n\t */\n\ttheme?: ChartTheme;\n\t/**\n\t * tooltip configuration\n\t */\n\ttooltip?: TooltipOptions;\n\t/**\n\t * legend configuration\n\t */\n\tlegend?: LegendOptions;\n\t/**\n\t * toolbar configurations\n\t */\n\ttoolbar?: ToolbarOptions;\n\t/**\n\t * Optional function to determine whether is filled based on datasetLabel, label, and/or data\n\t */\n\tgetIsFilled?: (\n\t\tdatasetLabel: any,\n\t\tlabel?: any,\n\t\tdata?: any,\n\t\tdefaultFilled?: boolean\n\t) => boolean;\n\t/**\n\t * Optional function to generate the fill color based on datasetLabel, label, and/or data\n\t */\n\tgetFillColor?: (\n\t\tgroup: string,\n\t\tlabel?: string,\n\t\tdata?: any,\n\t\tdefaultFillColor?: string\n\t) => string;\n\t/**\n\t * Optional function to generate the stroke color based on datasetLabel, label, and/or data\n\t * (note) - not all chart types support the stroke color (e.g. wordcloud)\n\t */\n\tgetStrokeColor?: (\n\t\tgroup: string,\n\t\tlabel?: any,\n\t\tdata?: any,\n\t\tdefaultStrokeColor?: string\n\t) => string;\n\t/**\n\t * stylesheet options\n\t */\n\tstyle?: {\n\t\t/**\n\t\t * optional prefixing string for css classes (defaults to 'cc')\n\t\t */\n\t\tprefix?: string;\n\t};\n\t/**\n\t * options related to charting data\n\t */\n\tdata?: {\n\t\t/**\n\t\t * identifier for data groups\n\t\t */\n\t\tgroupMapsTo?: string;\n\t\t/**\n\t\t * used to simulate data loading in skeleton way\n\t\t */\n\t\tloading?: boolean;\n\t\t/**\n\t\t * options related to pre-selected data groups\n\t\t * Remains empty if every legend item is active or dataset doesn't have the data groups.\n\t\t */\n\t\tselectedGroups?: string[];\n\t};\n\t/**\n\t * options related to color scales\n\t */\n\tcolor?: {\n\t\t/**\n\t\t * e.g. { 'Dataset 1': 'blue' }\n\t\t */\n\t\tscale?: object;\n\t\t/**\n\t\t * use a carbon dataviz preset color palette\n\t\t * put the index (selection of which variant)\n\t\t */\n\t\tpairing?: {\n\t\t\t/**\n\t\t\t * the number of color variants in the palette (defaults to using the number of data groups in the given data)\n\t\t\t */\n\t\t\tnumberOfVariants?: number;\n\t\t\t/**\n\t\t\t * the option number of the color paring\n\t\t\t */\n\t\t\toption?: number;\n\t\t};\n\t\t/*\n\t\t * options related to gradient\n\t\t * e.g. { enabled: true }\n\t\t */\n\t\tgradient?: {\n\t\t\tenabled?: boolean;\n\t\t\t/**\n\t\t\t * hex color array\n\t\t\t * e.g. ['#fff', '#000', ...]\n\t\t\t */\n\t\t\tcolors?: Array<String>;\n\t\t};\n\t};\n\t/*\n\t * options related to (CSV|PNG|JPG) file downloads\n\t */\n\tfileDownload?: {\n\t\t/**\n\t\t * the number of color variants in the palette (defaults to using the number of data groups in the given data)\n\t\t */\n\t\tfileName?: (type: 'png' | 'jpg' | 'csv') => string;\n\t};\n}\n\n/**\n * Options common to any chart with an axis\n */\nexport interface AxisChartOptions extends BaseChartOptions {\n\taxes?: AxesOptions<AxisOptions>;\n\tgrid?: GridOptions;\n\ttimeScale?: TimeScaleOptions;\n\t/**\n\t * zoombar configuration\n\t */\n\tzoomBar?: ZoomBarsOptions;\n}\n\n/**\n * Options common to binned charts with an axis\n */\nexport interface BinnedAxisChartOptions extends AxisChartOptions {\n\taxes?: AxesOptions<BinnedAxisOptions>;\n\tgrid?: GridOptions;\n\ttimeScale?: TimeScaleOptions;\n\t/**\n\t * zoombar configuration\n\t */\n\tzoomBar?: ZoomBarsOptions;\n}\n\n/**\n * options specific to boxplot charts\n */\nexport interface BoxplotChartOptions extends AxisChartOptions {}\n\n/**\n * options specific to bar charts\n */\nexport interface BarChartOptions extends AxisChartOptions {\n\tbars?: BarOptions;\n}\n\n/**\n * options specific to stacked bar charts\n */\nexport interface StackedBarChartOptions extends BarChartOptions {\n\tbars?: StackedBarOptions;\n}\n\n/**\n * options specific to scatter charts\n */\nexport interface ScatterChartOptions extends AxisChartOptions {\n\t/**\n\t * options for the points\n\t */\n\tpoints?: {\n\t\t/**\n\t\t * sets the radius of the point\n\t\t */\n\t\tradius: number;\n\t\tfillOpacity?: number;\n\t\tfilled?: boolean;\n\t\tenabled?: boolean;\n\t};\n}\n\n/**\n * options specific to lollipop charts\n */\nexport interface LollipopChartOptions extends ScatterChartOptions {}\n\n/**\n * options specific to bubble charts\n */\nexport interface BubbleChartOptions extends AxisChartOptions {\n\t/**\n\t * options for the individual bubbles\n\t */\n\tbubble?: {\n\t\t/**\n\t\t * the key to lookup in charting data for the bubble radius value\n\t\t */\n\t\tradiusMapsTo?: string;\n\t\t/**\n\t\t * options for what the bubble radius value maps to\n\t\t */\n\t\tradiusLabel?: string;\n\t\t/**\n\t\t * A function that would determine the range of the bubble radius to use\n\t\t * Returns an array with the 1st value being the min and the 2nd value being the max radius\n\t\t */\n\t\tradiusRange?: Function;\n\t\t/**\n\t\t * Opacity of the fills used within each circle\n\t\t */\n\t\tfillOpacity?: number;\n\t\t/**\n\t\t * enabled scatter dot or not\n\t\t */\n\t\tenabled?: boolean;\n\t};\n}\n\n/**\n * options specific to bullet charts\n */\nexport interface BulletChartOptions extends AxisChartOptions {\n\t/**\n\t * options for the individual bullets\n\t */\n\tbullet?: {\n\t\tperformanceAreaTitles?: string[];\n\t};\n}\n\n/**\n * options specific to histogram charts\n */\nexport interface HistogramChartOptions extends AxisChartOptions {\n\t/**\n\t * options related to bins\n\t */\n\tbins?: {\n\t\trangeLabel?: string;\n\t};\n}\n\n/**\n * options specific to line charts\n */\nexport interface LineChartOptions extends ScatterChartOptions {\n\t/**\n\t * options for the curve of the line\n\t */\n\tcurve?: string | { name: string };\n}\n\n/**\n * options specific to area charts\n */\nexport interface AreaChartOptions extends AxisChartOptions {\n\t/**\n\t * options for the curve of the line\n\t */\n\tcurve?: string | { name: string };\n\t/**\n\t * options to bound the area of the chart\n\t */\n\tbounds?: {\n\t\tupperBoundMapsTo?: string;\n\t\tlowerBoundMapsTo?: string;\n\t};\n}\n\n/**\n * options specific to area charts\n */\nexport interface StackedAreaChartOptions extends ScatterChartOptions {\n\t/**\n\t * options for the curve of the line\n\t */\n\tcurve?: string | { name: string };\n}\n\n/**\n * options specific to world cloud charts\n */\nexport interface WordCloudChartTooltipOptions extends TooltipOptions {\n\t/** the label that shows up by the highlighted word in the tooltip */\n\twordLabel?: string;\n\t/** the label that shows up by the value of the highlighted word in the tooltip */\n\tvalueLabel?: string;\n}\n\nexport interface WorldCloudChartOptions extends BaseChartOptions {\n\twordCloud?: {\n\t\t/** what key in your charting data will the font sizes map to? */\n\t\tfontSizeMapsTo?: string;\n\t\t/** a function (chartSize, data) => {} that'll decide the range of font sizes, e.g. [10, 80] */\n\t\tfontSizeRange?: Function;\n\t\t/** what key in your charting data will the words map to? */\n\t\twordMapsTo?: string;\n\t};\n\t/**\n\t * tooltip configuration\n\t */\n\ttooltip?: WordCloudChartTooltipOptions;\n}\n\n/**\n * options specific to pie charts\n */\nexport interface PieChartOptions extends BaseChartOptions {\n\tpie?: {\n\t\tlabels?: {\n\t\t\tformatter?: Function;\n\t\t\tenabled?: Boolean;\n\t\t};\n\t\talignment?: Alignments;\n\t\t/**\n\t\t * identifier for value key in your charting data\n\t\t * defaults to value\n\t\t */\n\t\tvalueMapsTo?: string;\n\t\tsortFunction?: (a: any, b: any) => number;\n\t};\n}\n\n/**\n * options specific to gauge charts\n */\nexport interface GaugeChartOptions extends BaseChartOptions {\n\tgauge?: {\n\t\tarcWidth?: number;\n\t\tdeltaArrow?: {\n\t\t\tdirection?: ArrowDirections;\n\t\t\tsize?: Function;\n\t\t\tenabled: Boolean;\n\t\t};\n\t\tshowPercentageSymbol?: Boolean;\n\t\tstatus?: Statuses;\n\t\tdeltaFontSize?: Function;\n\t\tnumberSpacing?: number;\n\t\tnumberFormatter?: Function;\n\t\tvalueFontSize?: Function;\n\t\ttype?: GaugeTypes;\n\t\talignment?: Alignments;\n\t};\n}\n\n/**\n * options specific to donut charts\n */\nexport interface DonutChartOptions extends PieChartOptions {\n\tdonut?: {\n\t\tcenter?: {\n\t\t\tlabel?: string;\n\t\t\tnumber?: number;\n\t\t\tnumberFontSize?: Function;\n\t\t\ttitleFontSize?: Function;\n\t\t\ttitleYPosition?: Function;\n\t\t\tnumberFormatter?: Function;\n\t\t};\n\t\talignment?: Alignments;\n\t};\n}\n\nexport interface MeterChartOptions extends BaseChartOptions {\n\tmeter?: {\n\t\tshowLabels?: boolean;\n\t\tproportional?: {\n\t\t\ttotal?: number;\n\t\t\tunit?: string;\n\t\t};\n\t\tpeak?: number;\n\t\tstatus?: {\n\t\t\tranges: Array<{\n\t\t\t\trange: [number, number];\n\t\t\t\tstatus: Statuses;\n\t\t\t}>;\n\t\t};\n\t\theight?: number;\n\t\ttitle?: {\n\t\t\tpercentageIndicator?: {\n\t\t\t\t/**\n\t\t\t\t * rendering of the percentage value relative to the dataset within title\n\t\t\t\t */\n\t\t\t\tenabled?: boolean;\n\t\t\t};\n\t\t};\n\t};\n}\n\nexport interface ProportionalMeterChartOptions extends BaseChartOptions {\n\tmeter?: {\n\t\tproportional?: {\n\t\t\ttotal?: number;\n\t\t\tunit?: string;\n\t\t};\n\t};\n}\n\n/**\n * options specific to radar charts\n */\nexport interface RadarChartOptions extends BaseChartOptions {\n\tradar?: {\n\t\taxes: {\n\t\t\tangle: string;\n\t\t\tvalue: string;\n\t\t};\n\t\talignment?: Alignments;\n\t};\n}\n\n/**\n * options specific to combo charts\n */\nexport interface ComboChartOptions extends AxisChartOptions {\n\taxes?: AxesOptions<ComboChartAxisOptions>;\n\tcomboChartTypes: Array<{\n\t\ttype: ChartTypes | any;\n\t\toptions?: object;\n\t\tcorrespondingDatasets: Array<string>;\n\t}>;\n}\n\n/*\n * options specific to treemap charts\n */\nexport interface TreemapChartOptions extends BaseChartOptions {}\n\n/*\n * options specific to tree charts\n */\nexport interface TreeChartOptions extends BaseChartOptions {\n\ttree?: {\n\t\ttype?: TreeTypes;\n\t\trootTitle?: string;\n\t};\n}\n\n/*\n * options specific to circle pack charts\n */\nexport interface CirclePackChartOptions extends BaseChartOptions {\n\tcirclePack?: {\n\t\tcircles: {\n\t\t\tfillOpacity: number;\n\t\t};\n\t\t// depth of nodes to display\n\t\thierachyLevel: number;\n\t\tpadding?: {\n\t\t\touter?: number;\n\t\t\tinner?: number;\n\t\t};\n\t};\n}\n\n/**\n * options specific to Alluvial charts\n */\nexport interface AlluvialChartOptions extends BaseChartOptions {\n\talluvial: {\n\t\tunits?: string;\n\t\t/**\n\t\t * List of nodes to draw\n\t\t */\n\t\tnodes: Array<{\n\t\t\tname: string;\n\t\t\tcategory?: string;\n\t\t}>;\n\t\t/**\n\t\t * Node alignment (Default is center)\n\t\t */\n\t\tnodeAlignment?: Alignments;\n\t\t/**\n\t\t * Set the node padding\n\t\t */\n\t\tnodePadding?: number;\n\t\t/**\n\t\t * Enable single color usage for lines\n\t\t */\n\t\tmonochrome?: boolean;\n\t};\n}\n\n/**\n * options specific to Heatmap charts\n */\nexport interface HeatmapChartOptions extends BaseChartOptions {\n\theatmap: {\n\t\t/**\n\t\t * Divider width state - will default to auto\n\t\t * No cell divider for cell dimensions less than 16\n\t\t */\n\t\tdivider?: {\n\t\t\tstate?: DividerStatus;\n\t\t};\n\t\t/**\n\t\t * customize color legend\n\t\t * enabled by default on select charts\n\t\t */\n\t\tcolorLegend?: {\n\t\t\t/**\n\t\t\t * Text to display beside or on top of the legend\n\t\t\t * Position is determined by text length\n\t\t\t */\n\t\t\ttitle?: string;\n\t\t\ttype: ColorLegendType;\n\t\t};\n\t};\n}\n"]}
|
package/model/model.js
CHANGED
|
@@ -586,7 +586,13 @@ var ChartModel = /** @class */ (function () {
|
|
|
586
586
|
csvData = d.join(',');
|
|
587
587
|
csvString += i < data.length ? csvData + '\n' : csvData;
|
|
588
588
|
});
|
|
589
|
-
this.
|
|
589
|
+
var options = this.getOptions();
|
|
590
|
+
var fileName = 'myChart';
|
|
591
|
+
var customFilename = Tools.getProperty(options, 'fileDownload', 'fileName');
|
|
592
|
+
if (typeof customFilename === 'function') {
|
|
593
|
+
fileName = customFilename('csv');
|
|
594
|
+
}
|
|
595
|
+
this.services.files.downloadCSV(csvString, fileName + ".csv");
|
|
590
596
|
};
|
|
591
597
|
ChartModel.prototype.getTabularData = function (data) {
|
|
592
598
|
// if data is not an array
|
package/model/model.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3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AAK;YAChB,OAAG,cAAc,SAAI,aAAa,UAAI,CAAC,KAAK,GAAG,EAAE,CAAC,GAAG,CAAC,CAAE;QAAxD,CAAwD,CACzD,CAAC;QAEF,kCAAkC;QAClC,IAAI,CAAC,eAAe,GAAG,YAAY,EAAE;aACnC,KAAK,CAAC,YAAY,CAAC;aACnB,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAC9B,CAAC;IACF,iBAAC;AAAD,CAAC,AAl3BD,IAk3BC","sourcesContent":["// Internal Imports\nimport * as Configuration from '../configuration';\nimport { histogram as histogramConfigs } from '../configuration-non-customizable';\n\nimport * as Tools from '../tools';\nimport { Events, ScaleTypes, ColorClassNameTypes } from '../interfaces';\n\n// D3\nimport { scaleOrdinal } from 'd3-scale';\nimport { stack, stackOffsetDiverging } from 'd3-shape';\nimport { histogram } from 'd3-array';\nimport { formatDateTillMilliSeconds } from '../services/time-series';\n\n/** The charting model layer which includes mainly the chart data and options,\n * as well as some misc. information to be shared among components */\nexport class ChartModel {\n\tprotected services: any;\n\n\t// Internal Model state\n\tprotected state: any = {\n\t\toptions: {},\n\t};\n\n\t// Data labels\n\t/**\n\t * A list of all the data groups that have existed within the lifetime of the chart\n\t * @type string[]\n\t */\n\tprotected allDataGroups: string[];\n\n\t// Fill scales & fill related objects\n\tprotected colorScale: any = {};\n\n\tprotected colorClassNames: any = {};\n\n\tconstructor(services: any) {\n\t\tthis.services = services;\n\t}\n\n\tgetAllDataFromDomain(groups?) {\n\t\tif (!this.getData()) {\n\t\t\treturn null;\n\t\t}\n\t\tconst options = this.getOptions();\n\t\t// Remove datasets that have been disabled\n\t\tlet allData = this.getData();\n\t\tconst dataGroups = this.getDataGroups();\n\t\tconst { groupMapsTo } = Tools.getProperty(options, 'data');\n\t\tconst axesOptions = Tools.getProperty(options, 'axes');\n\n\t\t// filter out the groups that are irrelevant to the component\n\t\tif (groups) {\n\t\t\tallData = allData.filter((item) =>\n\t\t\t\tgroups.includes(item[groupMapsTo])\n\t\t\t);\n\t\t}\n\n\t\tif (axesOptions) {\n\t\t\tObject.keys(axesOptions).forEach((axis) => {\n\t\t\t\tconst mapsTo = axesOptions[axis].mapsTo;\n\t\t\t\tconst scaleType = axesOptions[axis].scaleType;\n\t\t\t\t// make sure linear/log values are numbers\n\t\t\t\tif (\n\t\t\t\t\tscaleType === ScaleTypes.LINEAR ||\n\t\t\t\t\tscaleType === ScaleTypes.LOG\n\t\t\t\t) {\n\t\t\t\t\tallData = allData.map((datum) => {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t...datum,\n\t\t\t\t\t\t\t[mapsTo]:\n\t\t\t\t\t\t\t\tdatum[mapsTo] === null\n\t\t\t\t\t\t\t\t\t? datum[mapsTo]\n\t\t\t\t\t\t\t\t\t: Number(datum[mapsTo]),\n\t\t\t\t\t\t};\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\t// Check for custom domain\n\t\t\t\tif (mapsTo && axesOptions[axis].domain) {\n\t\t\t\t\tif (scaleType === ScaleTypes.LABELS) {\n\t\t\t\t\t\tallData = allData.filter((datum) =>\n\t\t\t\t\t\t\taxesOptions[axis].domain.includes(datum[mapsTo])\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst [start, end] = axesOptions[axis].domain;\n\t\t\t\t\t\t// Filter out data outside domain if that datapoint is using that axis (has mapsTo property)\n\t\t\t\t\t\tallData = allData.filter(\n\t\t\t\t\t\t\t(datum) =>\n\t\t\t\t\t\t\t\t!(mapsTo in datum) ||\n\t\t\t\t\t\t\t\t(datum[mapsTo] >= start && datum[mapsTo] <= end)\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\treturn allData.filter((datum) => {\n\t\t\treturn dataGroups.find(\n\t\t\t\t(group) => group.name === datum[groupMapsTo]\n\t\t\t);\n\t\t});\n\t}\n\n\t/**\n\t * Charts that have group configs passed into them, only want to retrieve the display data relevant to that chart\n\t * @param groups the included datasets for the particular chart\n\t */\n\tgetDisplayData(groups?) {\n\t\tif (!this.get('data')) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst { ACTIVE } = Configuration.legend.items.status;\n\t\tconst dataGroups = this.getDataGroups(groups);\n\t\tconst { groupMapsTo } = this.getOptions().data;\n\t\tconst allDataFromDomain = this.getAllDataFromDomain(groups);\n\n\t\treturn allDataFromDomain.filter((datum) => {\n\t\t\treturn dataGroups.find(\n\t\t\t\t(dataGroup) =>\n\t\t\t\t\tdataGroup.name === datum[groupMapsTo] &&\n\t\t\t\t\tdataGroup.status === ACTIVE\n\t\t\t);\n\t\t});\n\t}\n\n\tgetData() {\n\t\treturn this.get('data');\n\t}\n\n\tisDataEmpty() {\n\t\treturn !this.getData().length;\n\t}\n\n\t/**\n\t *\n\t * @param newData The new raw data to be set\n\t */\n\tsetData(newData) {\n\t\tconst sanitizedData = this.sanitize(Tools.clone(newData));\n\t\tconst dataGroups = this.generateDataGroups(sanitizedData);\n\n\t\tthis.set({\n\t\t\tdata: sanitizedData,\n\t\t\tdataGroups,\n\t\t});\n\n\t\treturn sanitizedData;\n\t}\n\n\tgetDataGroups(groups?) {\n\t\tconst isDataLoading = Tools.getProperty(\n\t\t\tthis.getOptions(),\n\t\t\t'data',\n\t\t\t'loading'\n\t\t);\n\n\t\t// No data should be displayed while data is still loading\n\t\tif (isDataLoading) {\n\t\t\treturn [];\n\t\t}\n\n\t\t// if its a combo chart, the specific chart will pass the model the groups it needs\n\t\tif (groups) {\n\t\t\treturn this.get('dataGroups').filter((dataGroup) =>\n\t\t\t\tgroups.includes(dataGroup.name)\n\t\t\t);\n\t\t}\n\t\treturn this.get('dataGroups');\n\t}\n\n\tgetActiveDataGroups(groups?) {\n\t\tconst { ACTIVE } = Configuration.legend.items.status;\n\n\t\treturn this.getDataGroups(groups).filter(\n\t\t\t(dataGroup) => dataGroup.status === ACTIVE\n\t\t);\n\t}\n\n\tgetDataGroupNames(groups?) {\n\t\tconst dataGroups = this.getDataGroups(groups);\n\t\treturn dataGroups.map((dataGroup) => dataGroup.name);\n\t}\n\n\tgetActiveDataGroupNames(groups?) {\n\t\tconst activeDataGroups = this.getActiveDataGroups(groups);\n\t\treturn activeDataGroups.map((dataGroup) => dataGroup.name);\n\t}\n\n\tprivate aggregateBinDataByGroup(bin) {\n\t\treturn Tools.groupBy(bin, 'group');\n\t}\n\n\tgetBinConfigurations() {\n\t\t// Manipulate data and options for Histogram\n\t\tconst data = this.getDisplayData();\n\t\tconst options = this.getOptions();\n\n\t\tconst mainXPos = this.services.cartesianScales.getMainXAxisPosition();\n\t\tconst domainIdentifier = this.services.cartesianScales.getDomainIdentifier();\n\n\t\tconst axisOptions = options.axes[mainXPos];\n\t\tconst { groupMapsTo } = options.data;\n\t\tconst { bins: axisBins = histogramConfigs.defaultBins } = axisOptions;\n\t\tconst areBinsDefined = Array.isArray(axisBins);\n\n\t\t// Get Histogram bins\n\t\tconst bins = histogram()\n\t\t\t.value((d) => d[domainIdentifier])\n\t\t\t.thresholds(axisBins)(data);\n\n\t\tif (!areBinsDefined) {\n\t\t\t// If bins are not defined by user\n\t\t\tconst binsWidth = bins[0].x1 - bins[0].x0;\n\t\t\t// Set last bin width as the others\n\t\t\tbins[bins.length - 1].x1 = +bins[bins.length - 1].x0 + binsWidth;\n\t\t} else {\n\t\t\t// Set last bin end as the last user defined one\n\t\t\tbins[bins.length - 1].x1 = axisBins[axisBins.length - 1];\n\t\t}\n\n\t\tconst binsDomain = areBinsDefined\n\t\t\t? [axisBins[0], axisBins[axisBins.length - 1]]\n\t\t\t: [bins[0].x0, bins[bins.length - 1].x1];\n\n\t\t// Get all groups\n\t\tconst groupsKeys = Array.from(new Set(data.map((d) => d[groupMapsTo])));\n\n\t\tconst histogramData = [];\n\n\t\t// Group data by bin\n\t\tbins.forEach((bin) => {\n\t\t\tconst key = `${bin.x0}-${bin.x1}`;\n\t\t\tconst aggregateDataByGroup = this.aggregateBinDataByGroup(bin);\n\n\t\t\tgroupsKeys.forEach((group: string) => {\n\t\t\t\t// For each dataset put a bin with value 0 if not exist\n\t\t\t\t// (Scale X won't change when changing showed datasets)\n\t\t\t\thistogramData.push({\n\t\t\t\t\tgroup,\n\t\t\t\t\tkey,\n\t\t\t\t\tvalue: aggregateDataByGroup[group] || 0,\n\t\t\t\t\tbin: bin.x0,\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\n\t\treturn {\n\t\t\tbins,\n\t\t\tbinsDomain,\n\t\t};\n\t}\n\n\tgetBinnedStackedData() {\n\t\tconst options = this.getOptions();\n\t\tconst { groupMapsTo } = options.data;\n\n\t\tconst dataGroupNames = this.getActiveDataGroupNames();\n\n\t\tconst { bins } = this.getBinConfigurations();\n\t\tconst dataValuesGroupedByKeys = this.getDataValuesGroupedByKeys({\n\t\t\tbins,\n\t\t});\n\n\t\treturn stack()\n\t\t\t.keys(dataGroupNames)(dataValuesGroupedByKeys)\n\t\t\t.map((series, i) => {\n\t\t\t\t// Add data group names to each series\n\t\t\t\treturn Object.keys(series)\n\t\t\t\t\t.filter((key: any) => !isNaN(key))\n\t\t\t\t\t.map((key) => {\n\t\t\t\t\t\tconst element = series[key];\n\t\t\t\t\t\telement[groupMapsTo] = dataGroupNames[i];\n\n\t\t\t\t\t\treturn element;\n\t\t\t\t\t});\n\t\t\t});\n\t}\n\n\tgetGroupedData(groups?) {\n\t\tconst displayData = this.getDisplayData(groups);\n\t\tconst groupedData = {};\n\t\tconst { groupMapsTo } = this.getOptions().data;\n\n\t\tdisplayData.map((datum) => {\n\t\t\tconst group = datum[groupMapsTo];\n\t\t\tif (\n\t\t\t\tgroupedData[group] !== null &&\n\t\t\t\tgroupedData[group] !== undefined\n\t\t\t) {\n\t\t\t\tgroupedData[group].push(datum);\n\t\t\t} else {\n\t\t\t\tgroupedData[group] = [datum];\n\t\t\t}\n\t\t});\n\n\t\treturn Object.keys(groupedData).map((groupName) => ({\n\t\t\tname: groupName,\n\t\t\tdata: groupedData[groupName],\n\t\t}));\n\t}\n\n\tgetStackKeys(\n\t\t{ bins = null, groups = null } = { bins: null, groups: null }\n\t) {\n\t\tconst options = this.getOptions();\n\n\t\tconst displayData = this.getDisplayData(groups);\n\n\t\tlet stackKeys;\n\t\tif (bins) {\n\t\t\tstackKeys = bins.map((bin) => `${bin.x0}-${bin.x1}`);\n\t\t} else {\n\t\t\tstackKeys = Tools.removeArrayDuplicates(\n\t\t\t\tdisplayData.map((datum) => {\n\t\t\t\t\tconst domainIdentifier = this.services.cartesianScales.getDomainIdentifier(\n\t\t\t\t\t\tdatum\n\t\t\t\t\t);\n\n\t\t\t\t\t// Use time value as key for Date object to avoid multiple data in the same second\n\t\t\t\t\tif (datum[domainIdentifier] instanceof Date) {\n\t\t\t\t\t\treturn formatDateTillMilliSeconds(\n\t\t\t\t\t\t\tdatum[domainIdentifier]\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn datum[domainIdentifier] &&\n\t\t\t\t\t\ttypeof datum[domainIdentifier].toString === 'function'\n\t\t\t\t\t\t? datum[domainIdentifier].toString()\n\t\t\t\t\t\t: datum[domainIdentifier];\n\t\t\t\t})\n\t\t\t);\n\t\t}\n\n\t\tconst axisPosition = this.services.cartesianScales.domainAxisPosition;\n\t\tconst scaleType = options.axes[axisPosition].scaleType;\n\n\t\t// Sort keys\n\t\tif (scaleType === ScaleTypes.TIME) {\n\t\t\tstackKeys.sort((a: any, b: any) => {\n\t\t\t\tconst dateA: any = new Date(a);\n\t\t\t\tconst dateB: any = new Date(b);\n\n\t\t\t\treturn dateA - dateB;\n\t\t\t});\n\t\t} else if (\n\t\t\tscaleType === ScaleTypes.LOG ||\n\t\t\tscaleType === ScaleTypes.LINEAR\n\t\t) {\n\t\t\tstackKeys.sort((a: any, b: any) => a - b);\n\t\t}\n\n\t\treturn stackKeys;\n\t}\n\n\tgetDataValuesGroupedByKeys({ bins = null, groups = null }) {\n\t\tconst options = this.getOptions();\n\t\tconst { groupMapsTo } = options.data;\n\t\tconst displayData = this.getDisplayData(groups);\n\n\t\tconst dataGroupNames = this.getDataGroupNames();\n\n\t\tconst stackKeys = this.getStackKeys({ bins, groups });\n\t\tif (bins) {\n\t\t\treturn stackKeys.map((key) => {\n\t\t\t\tconst [binStart, binEnd] = key.split('-');\n\n\t\t\t\tconst correspondingValues = { x0: binStart, x1: binEnd };\n\t\t\t\tconst correspondingBin = bins.find(\n\t\t\t\t\t(bin) => bin.x0.toString() === binStart.toString()\n\t\t\t\t);\n\n\t\t\t\tdataGroupNames.forEach((dataGroupName) => {\n\t\t\t\t\tcorrespondingValues[\n\t\t\t\t\t\tdataGroupName\n\t\t\t\t\t] = correspondingBin.filter(\n\t\t\t\t\t\t(binItem) => binItem[groupMapsTo] === dataGroupName\n\t\t\t\t\t).length;\n\t\t\t\t});\n\n\t\t\t\treturn correspondingValues;\n\t\t\t}) as any;\n\t\t}\n\n\t\treturn stackKeys.map((key) => {\n\t\t\tconst correspondingValues = { sharedStackKey: key };\n\t\t\tdataGroupNames.forEach((dataGroupName) => {\n\t\t\t\tconst correspondingDatum = displayData.find((datum) => {\n\t\t\t\t\tconst domainIdentifier = this.services.cartesianScales.getDomainIdentifier(\n\t\t\t\t\t\tdatum\n\t\t\t\t\t);\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\tdatum[groupMapsTo] === dataGroupName &&\n\t\t\t\t\t\tdatum.hasOwnProperty(domainIdentifier) &&\n\t\t\t\t\t\t(datum[domainIdentifier] instanceof Date\n\t\t\t\t\t\t\t? formatDateTillMilliSeconds(\n\t\t\t\t\t\t\t\t\tdatum[domainIdentifier]\n\t\t\t\t\t\t\t ) === key\n\t\t\t\t\t\t\t: datum[domainIdentifier].toString() === key)\n\t\t\t\t\t);\n\t\t\t\t});\n\n\t\t\t\tconst rangeIdentifier = this.services.cartesianScales.getRangeIdentifier(\n\t\t\t\t\tcorrespondingValues\n\t\t\t\t);\n\t\t\t\tcorrespondingValues[dataGroupName] = correspondingDatum\n\t\t\t\t\t? correspondingDatum[rangeIdentifier]\n\t\t\t\t\t: null;\n\t\t\t});\n\n\t\t\treturn correspondingValues;\n\t\t}) as any;\n\t}\n\n\tgetStackedData({ percentage = false, groups = null, divergent = false }) {\n\t\tconst options = this.getOptions();\n\t\tconst { groupMapsTo } = options.data;\n\n\t\t// Get only active data groups so non-active data groups are not rendered\n\t\t// on legend item click\n\t\tconst dataGroupNames = this.getActiveDataGroupNames(groups);\n\t\tconst dataValuesGroupedByKeys = this.getDataValuesGroupedByKeys({\n\t\t\tgroups,\n\t\t});\n\n\t\tif (percentage) {\n\t\t\tconst maxByKey = Tools.fromPairs(\n\t\t\t\tdataValuesGroupedByKeys.map((d: any) => [d.sharedStackKey, 0])\n\t\t\t);\n\n\t\t\tdataValuesGroupedByKeys.forEach((d: any) => {\n\t\t\t\tdataGroupNames.forEach((name) => {\n\t\t\t\t\tmaxByKey[d.sharedStackKey] += d[name];\n\t\t\t\t});\n\t\t\t});\n\n\t\t\t// cycle through data values to get percentage\n\t\t\tdataValuesGroupedByKeys.forEach((d: any) => {\n\t\t\t\tdataGroupNames.forEach((name) => {\n\t\t\t\t\tif (maxByKey[d.sharedStackKey]) {\n\t\t\t\t\t\td[name] = (d[name] / maxByKey[d.sharedStackKey]) * 100;\n\t\t\t\t\t} else {\n\t\t\t\t\t\td[name] = 0;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n\t\t}\n\n\t\tconst stackToUse = divergent\n\t\t\t? stack().offset(stackOffsetDiverging)\n\t\t\t: stack();\n\n\t\treturn stackToUse\n\t\t\t.keys(dataGroupNames)(dataValuesGroupedByKeys)\n\t\t\t.map((series, i) => {\n\t\t\t\t// Add data group names to each series\n\t\t\t\treturn Object.keys(series)\n\t\t\t\t\t.filter((key: any) => !isNaN(key))\n\t\t\t\t\t.map((key) => {\n\t\t\t\t\t\tconst element = series[key];\n\t\t\t\t\t\telement[groupMapsTo] = dataGroupNames[i];\n\n\t\t\t\t\t\treturn element;\n\t\t\t\t\t});\n\t\t\t});\n\t}\n\n\t/**\n\t * @return {Object} The chart's options\n\t */\n\tgetOptions() {\n\t\treturn this.state.options;\n\t}\n\n\tset(newState: any, configs?: any) {\n\t\tthis.state = Object.assign({}, this.state, newState);\n\t\tconst newConfig = Object.assign(\n\t\t\t{ skipUpdate: false, animate: true }, // default configs\n\t\t\tconfigs\n\t\t);\n\t\tif (!newConfig.skipUpdate) {\n\t\t\tthis.update(newConfig.animate);\n\t\t}\n\t}\n\n\tget(property?: string) {\n\t\tif (property) {\n\t\t\treturn this.state[property];\n\t\t} else {\n\t\t\treturn this.state;\n\t\t}\n\t}\n\n\t/**\n\t *\n\t * @param newOptions New options to be set\n\t */\n\tsetOptions(newOptions) {\n\t\tconst options = this.getOptions();\n\t\tTools.updateLegendAdditionalItems(options, newOptions);\n\n\t\tthis.set({\n\t\t\toptions: Tools.merge(options, newOptions),\n\t\t});\n\t}\n\n\t/**\n\t *\n\t * Updates miscellanous information within the model\n\t * such as the color scales, or the legend data labels\n\t */\n\tupdate(animate = true) {\n\t\tif (!this.getDisplayData()) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.updateAllDataGroups();\n\n\t\tthis.setCustomColorScale();\n\t\tthis.setColorClassNames();\n\t\tthis.services.events.dispatchEvent(Events.Model.UPDATE, { animate });\n\t}\n\n\t/*\n\t * Data labels\n\t */\n\ttoggleDataLabel(changedLabel: string) {\n\t\tconst { ACTIVE, DISABLED } = Configuration.legend.items.status;\n\t\tconst dataGroups = this.getDataGroups();\n\n\t\tconst hasDeactivatedItems = dataGroups.some(\n\t\t\t(group) => group.status === DISABLED\n\t\t);\n\t\tconst activeItems = dataGroups.filter(\n\t\t\t(group) => group.status === ACTIVE\n\t\t);\n\n\t\t// If there are deactivated items, toggle \"changedLabel\"\n\t\tif (hasDeactivatedItems) {\n\t\t\t// If the only active item is being toggled\n\t\t\t// Activate all items\n\t\t\tif (\n\t\t\t\tactiveItems.length === 1 &&\n\t\t\t\tactiveItems[0].name === changedLabel\n\t\t\t) {\n\t\t\t\t// If every item is active, then enable \"changedLabel\" and disable all other items\n\t\t\t\tdataGroups.forEach((group, i) => {\n\t\t\t\t\tdataGroups[i].status = ACTIVE;\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tconst indexToChange = dataGroups.findIndex(\n\t\t\t\t\t(group) => group.name === changedLabel\n\t\t\t\t);\n\t\t\t\tdataGroups[indexToChange].status =\n\t\t\t\t\tdataGroups[indexToChange].status === DISABLED\n\t\t\t\t\t\t? ACTIVE\n\t\t\t\t\t\t: DISABLED;\n\t\t\t}\n\t\t} else {\n\t\t\t// If every item is active, then enable \"changedLabel\" and disable all other items\n\t\t\tdataGroups.forEach((group, i) => {\n\t\t\t\tdataGroups[i].status =\n\t\t\t\t\tgroup.name === changedLabel ? ACTIVE : DISABLED;\n\t\t\t});\n\t\t}\n\n\t\t// Updates selected groups\n\t\tconst updatedActiveItems = dataGroups.filter(\n\t\t\t(group) => group.status === ACTIVE\n\t\t);\n\t\tconst options = this.getOptions();\n\n\t\tconst hasUpdatedDeactivatedItems = dataGroups.some(\n\t\t\t(group) => group.status === DISABLED\n\t\t);\n\n\t\t// If there are deactivated items, map the item name into selected groups\n\t\tif (hasUpdatedDeactivatedItems) {\n\t\t\toptions.data.selectedGroups = updatedActiveItems.map(\n\t\t\t\t(activeItem) => activeItem.name\n\t\t\t);\n\t\t} else {\n\t\t\t// If every item is active, clear array\n\t\t\toptions.data.selectedGroups = [];\n\t\t}\n\n\t\t// dispatch legend filtering event with the status of all the dataLabels\n\t\tthis.services.events.dispatchEvent(Events.Legend.ITEMS_UPDATE, {\n\t\t\tdataGroups,\n\t\t});\n\n\t\t// Update model\n\t\tthis.set({\n\t\t\tdataGroups,\n\t\t});\n\t}\n\n\t/**\n\t * Should the data point be filled?\n\t * @param group\n\t * @param key\n\t * @param value\n\t * @param defaultFilled the default for this chart\n\t */\n\tgetIsFilled(group: any, key?: any, data?: any, defaultFilled?: boolean) {\n\t\tconst options = this.getOptions();\n\t\tif (options.getIsFilled) {\n\t\t\treturn options.getIsFilled(group, key, data, defaultFilled);\n\t\t} else {\n\t\t\treturn defaultFilled;\n\t\t}\n\t}\n\n\tgetFillColor(group: any, key?: any, data?: any) {\n\t\tconst options = this.getOptions();\n\t\tconst defaultFillColor = Tools.getProperty(this.colorScale, group);\n\n\t\tif (options.getFillColor) {\n\t\t\treturn options.getFillColor(group, key, data, defaultFillColor);\n\t\t} else {\n\t\t\treturn defaultFillColor;\n\t\t}\n\t}\n\n\tgetStrokeColor(group: any, key?: any, data?: any) {\n\t\tconst options = this.getOptions();\n\t\tconst defaultStrokeColor = Tools.getProperty(this.colorScale, group);\n\n\t\tif (options.getStrokeColor) {\n\t\t\treturn options.getStrokeColor(group, key, data, defaultStrokeColor);\n\t\t} else {\n\t\t\treturn defaultStrokeColor;\n\t\t}\n\t}\n\n\tisUserProvidedColorScaleValid() {\n\t\tconst userProvidedScale = Tools.getProperty(\n\t\t\tthis.getOptions(),\n\t\t\t'color',\n\t\t\t'scale'\n\t\t);\n\t\tconst dataGroups = this.getDataGroups();\n\n\t\tif (\n\t\t\tuserProvidedScale == null ||\n\t\t\tObject.keys(userProvidedScale).length == 0\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn dataGroups.some((dataGroup) =>\n\t\t\tObject.keys(userProvidedScale).includes(dataGroup.name)\n\t\t);\n\t}\n\n\tgetColorClassName(configs: {\n\t\tclassNameTypes: ColorClassNameTypes[];\n\t\tdataGroupName?: string;\n\t\toriginalClassName?: string;\n\t}) {\n\t\tconst colorPairingTag = this.colorClassNames(configs.dataGroupName);\n\t\tlet className = configs.originalClassName;\n\t\tconfigs.classNameTypes.forEach(\n\t\t\t(type) =>\n\t\t\t\t(className = configs.originalClassName\n\t\t\t\t\t? `${className} ${type}-${colorPairingTag}`\n\t\t\t\t\t: `${type}-${colorPairingTag}`)\n\t\t);\n\n\t\treturn className;\n\t}\n\n\t/**\n\t * For charts that might hold an associated status for their dataset\n\t */\n\tgetStatus() {\n\t\treturn null;\n\t}\n\n\tgetAllDataGroupsNames() {\n\t\treturn this.allDataGroups;\n\t}\n\n\t/**\n\t * Converts data provided in the older format to tabular\n\t *\n\t */\n\tprotected transformToTabularData(data) {\n\t\tconsole.warn(\n\t\t\t\"We've updated the charting data format to be tabular by default. The current format you're using is deprecated and will be removed in v1.0, read more here https://carbon-design-system.github.io/carbon-charts/?path=/story/docs-tutorials--tabular-data-format\"\n\t\t);\n\t\tconst tabularData = [];\n\t\tconst { datasets, labels } = data;\n\n\t\t// Loop through all datasets\n\t\tdatasets.forEach((dataset) => {\n\t\t\t// Update each data point to the new format\n\t\t\tdataset.data.forEach((datum, i) => {\n\t\t\t\tlet group;\n\n\t\t\t\tconst datasetLabel = Tools.getProperty(dataset, 'label');\n\t\t\t\tif (datasetLabel === null) {\n\t\t\t\t\tconst correspondingLabel = Tools.getProperty(labels, i);\n\t\t\t\t\tif (correspondingLabel) {\n\t\t\t\t\t\tgroup = correspondingLabel;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tgroup = 'Ungrouped';\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tgroup = datasetLabel;\n\t\t\t\t}\n\n\t\t\t\tconst updatedDatum = {\n\t\t\t\t\tgroup,\n\t\t\t\t\tkey: labels[i],\n\t\t\t\t};\n\n\t\t\t\tif (isNaN(datum)) {\n\t\t\t\t\tupdatedDatum['value'] = datum.value;\n\t\t\t\t\tupdatedDatum['date'] = datum.date;\n\t\t\t\t} else {\n\t\t\t\t\tupdatedDatum['value'] = datum;\n\t\t\t\t}\n\n\t\t\t\ttabularData.push(updatedDatum);\n\t\t\t});\n\t\t});\n\n\t\treturn tabularData;\n\t}\n\n\tgetTabularDataArray() {\n\t\treturn [];\n\t}\n\n\texportToCSV() {\n\t\tlet data = this.getTabularDataArray().map((row) =>\n\t\t\trow.map((column) => `\\\"${column === '–' ? '–' : column}\\\"`)\n\t\t);\n\n\t\tlet csvString = '',\n\t\t\tcsvData = '';\n\t\tdata.forEach(function (d, i) {\n\t\t\tcsvData = d.join(',');\n\t\t\tcsvString += i < data.length ? csvData + '\\n' : csvData;\n\t\t});\n\n\t\tthis.services.files.downloadCSV(csvString, 'myChart.csv');\n\t}\n\n\tprotected getTabularData(data) {\n\t\t// if data is not an array\n\t\tif (!Array.isArray(data)) {\n\t\t\treturn this.transformToTabularData(data);\n\t\t}\n\n\t\treturn data;\n\t}\n\n\tprotected sanitize(data) {\n\t\tdata = this.getTabularData(data);\n\n\t\treturn data;\n\t}\n\n\t/*\n\t * Data groups\n\t */\n\tprotected updateAllDataGroups() {\n\t\t// allDataGroups is used to generate a color scale that applies\n\t\t// to all the groups. Now when the data updates, you might remove a group,\n\t\t// and then bring it back in a newer data update, therefore\n\t\t// the order of the groups in allDataGroups matters so that you'd never\n\t\t// have an incorrect color assigned to a group.\n\n\t\t// Also, a new group should only be added to allDataGroups if\n\t\t// it doesn't currently exist\n\n\t\tif (!this.allDataGroups) {\n\t\t\tthis.allDataGroups = this.getDataGroupNames();\n\t\t} else {\n\t\t\t// Loop through current data groups\n\t\t\tthis.getDataGroupNames().forEach((dataGroupName) => {\n\t\t\t\t// If group name hasn't been stored yet, store it\n\t\t\t\tif (this.allDataGroups.indexOf(dataGroupName) === -1) {\n\t\t\t\t\tthis.allDataGroups.push(dataGroupName);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\tprotected generateDataGroups(data) {\n\t\tconst { groupMapsTo } = this.getOptions().data;\n\t\tconst { ACTIVE, DISABLED } = Configuration.legend.items.status;\n\t\tconst options = this.getOptions();\n\n\t\tconst uniqueDataGroups = Tools.removeArrayDuplicates(\n\t\t\tdata.map((datum) => datum[groupMapsTo])\n\t\t);\n\n\t\t// check if selectedGroups can be applied to chart with current data groups\n\t\tif (options.data.selectedGroups.length) {\n\t\t\tconst hasAllSelectedGroups = options.data.selectedGroups.every(\n\t\t\t\t(groupName) => uniqueDataGroups.includes(groupName)\n\t\t\t);\n\t\t\tif (!hasAllSelectedGroups) {\n\t\t\t\toptions.data.selectedGroups = [];\n\t\t\t}\n\t\t}\n\n\t\t// Get group status based on items in selected groups\n\t\tconst getStatus = (groupName) =>\n\t\t\t!options.data.selectedGroups.length ||\n\t\t\toptions.data.selectedGroups.includes(groupName)\n\t\t\t\t? ACTIVE\n\t\t\t\t: DISABLED;\n\n\t\treturn uniqueDataGroups.map((groupName) => ({\n\t\t\tname: groupName,\n\t\t\tstatus: getStatus(groupName),\n\t\t}));\n\t}\n\n\t/*\n\t * Fill scales\n\t */\n\tprotected setCustomColorScale() {\n\t\tif (!this.isUserProvidedColorScaleValid()) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst options = this.getOptions();\n\t\tconst userProvidedScale = Tools.getProperty(options, 'color', 'scale');\n\n\t\tObject.keys(userProvidedScale).forEach((dataGroup) => {\n\t\t\tif (!this.allDataGroups.includes(dataGroup)) {\n\t\t\t\tconsole.warn(`\"${dataGroup}\" does not exist in data groups.`);\n\t\t\t}\n\t\t});\n\n\t\t/**\n\t\t * Go through allDataGroups. If a data group has a color value provided\n\t\t * by the user, add that to the color range\n\t\t */\n\t\tconst providedDataGroups = this.allDataGroups.filter(\n\t\t\t(dataGroup) => userProvidedScale[dataGroup]\n\t\t);\n\n\t\tprovidedDataGroups.forEach(\n\t\t\t(dataGroup) =>\n\t\t\t\t(this.colorScale[dataGroup] = userProvidedScale[dataGroup])\n\t\t);\n\t}\n\n\t/*\n\t * Color palette\n\t */\n\tprotected setColorClassNames() {\n\t\tconst colorPairingOptions = Tools.getProperty(\n\t\t\tthis.getOptions(),\n\t\t\t'color',\n\t\t\t'pairing'\n\t\t);\n\n\t\t// Check if user has defined numberOfVariants (differ from given data)\n\t\tlet numberOfVariants = Tools.getProperty(\n\t\t\tcolorPairingOptions,\n\t\t\t'numberOfVariants'\n\t\t);\n\t\tif (!numberOfVariants || numberOfVariants < this.allDataGroups.length) {\n\t\t\tnumberOfVariants = this.allDataGroups.length;\n\t\t}\n\n\t\tlet pairingOption = Tools.getProperty(colorPairingOptions, 'option');\n\t\tconst colorPairingCounts = Configuration.color.pairingOptions;\n\n\t\t// If number of dataGroups is greater than 5, user 14-color palette\n\t\tconst numberOfColors = numberOfVariants > 5 ? 14 : numberOfVariants;\n\n\t\t// Use default palette if user choice is not in range\n\t\tpairingOption =\n\t\t\tpairingOption <= colorPairingCounts[`${numberOfColors}-color`]\n\t\t\t\t? pairingOption\n\t\t\t\t: 1;\n\n\t\t// Create color classes for graph, tooltip and stroke use\n\t\tconst colorPairing = this.allDataGroups.map(\n\t\t\t(dataGroup, index) =>\n\t\t\t\t`${numberOfColors}-${pairingOption}-${(index % 14) + 1}`\n\t\t);\n\n\t\t// Create default color classnames\n\t\tthis.colorClassNames = scaleOrdinal()\n\t\t\t.range(colorPairing)\n\t\t\t.domain(this.allDataGroups);\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["model.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,mBAAmB;AACnB,OAAO,KAAK,aAAa,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,SAAS,IAAI,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAElF,OAAO,KAAK,KAAK,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAuB,MAAM,eAAe,CAAC;AAExE,KAAK;AACL,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAErE;qEACqE;AACrE;IAoBC,oBAAY,QAAa;QAjBzB,uBAAuB;QACb,UAAK,GAAQ;YACtB,OAAO,EAAE,EAAE;SACX,CAAC;QASF,qCAAqC;QAC3B,eAAU,GAAQ,EAAE,CAAC;QAErB,oBAAe,GAAQ,EAAE,CAAC;QAGnC,IAAI,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W,CAC5C,IAAI,CAAC,UAAU,EAAE,EACjB,OAAO,EACP,SAAS,CACT,CAAC;QAEF,sEAAsE;QACtE,IAAI,gBAAgB,GAAG,KAAK,CAAC,WAAW,CACvC,mBAAmB,EACnB,kBAAkB,CAClB,CAAC;QACF,IAAI,CAAC,gBAAgB,IAAI,gBAAgB,GAAG,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE;YACtE,gBAAgB,GAAG,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC;SAC7C;QAED,IAAI,aAAa,GAAG,KAAK,CAAC,WAAW,CAAC,mBAAmB,EAAE,QAAQ,CAAC,CAAC;QACrE,IAAM,kBAAkB,GAAG,aAAa,CAAC,KAAK,CAAC,cAAc,CAAC;QAE9D,mEAAmE;QACnE,IAAM,cAAc,GAAG,gBAAgB,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,gBAAgB,CAAC;QAEpE,qDAAqD;QACrD,aAAa;YACZ,aAAa,IAAI,kBAAkB,CAAI,cAAc,WAAQ,CAAC;gBAC7D,CAAC,CAAC,aAAa;gBACf,CAAC,CAAC,CAAC,CAAC;QAEN,yDAAyD;QACzD,IAAM,YAAY,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAC1C,UAAC,SAAS,EAAE,KAAK;YAChB,OAAG,cAAc,SAAI,aAAa,UAAI,CAAC,KAAK,GAAG,EAAE,CAAC,GAAG,CAAC,CAAE;QAAxD,CAAwD,CACzD,CAAC;QAEF,kCAAkC;QAClC,IAAI,CAAC,eAAe,GAAG,YAAY,EAAE;aACnC,KAAK,CAAC,YAAY,CAAC;aACnB,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAC9B,CAAC;IACF,iBAAC;AAAD,CAAC,AA/3BD,IA+3BC","sourcesContent":["// Internal Imports\nimport * as Configuration from '../configuration';\nimport { histogram as histogramConfigs } from '../configuration-non-customizable';\n\nimport * as Tools from '../tools';\nimport { Events, ScaleTypes, ColorClassNameTypes } from '../interfaces';\n\n// D3\nimport { scaleOrdinal } from 'd3-scale';\nimport { stack, stackOffsetDiverging } from 'd3-shape';\nimport { histogram } from 'd3-array';\nimport { formatDateTillMilliSeconds } from '../services/time-series';\n\n/** The charting model layer which includes mainly the chart data and options,\n * as well as some misc. information to be shared among components */\nexport class ChartModel {\n\tprotected services: any;\n\n\t// Internal Model state\n\tprotected state: any = {\n\t\toptions: {},\n\t};\n\n\t// Data labels\n\t/**\n\t * A list of all the data groups that have existed within the lifetime of the chart\n\t * @type string[]\n\t */\n\tprotected allDataGroups: string[];\n\n\t// Fill scales & fill related objects\n\tprotected colorScale: any = {};\n\n\tprotected colorClassNames: any = {};\n\n\tconstructor(services: any) {\n\t\tthis.services = services;\n\t}\n\n\tgetAllDataFromDomain(groups?) {\n\t\tif (!this.getData()) {\n\t\t\treturn null;\n\t\t}\n\t\tconst options = this.getOptions();\n\t\t// Remove datasets that have been disabled\n\t\tlet allData = this.getData();\n\t\tconst dataGroups = this.getDataGroups();\n\t\tconst { groupMapsTo } = Tools.getProperty(options, 'data');\n\t\tconst axesOptions = Tools.getProperty(options, 'axes');\n\n\t\t// filter out the groups that are irrelevant to the component\n\t\tif (groups) {\n\t\t\tallData = allData.filter((item) =>\n\t\t\t\tgroups.includes(item[groupMapsTo])\n\t\t\t);\n\t\t}\n\n\t\tif (axesOptions) {\n\t\t\tObject.keys(axesOptions).forEach((axis) => {\n\t\t\t\tconst mapsTo = axesOptions[axis].mapsTo;\n\t\t\t\tconst scaleType = axesOptions[axis].scaleType;\n\t\t\t\t// make sure linear/log values are numbers\n\t\t\t\tif (\n\t\t\t\t\tscaleType === ScaleTypes.LINEAR ||\n\t\t\t\t\tscaleType === ScaleTypes.LOG\n\t\t\t\t) {\n\t\t\t\t\tallData = allData.map((datum) => {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t...datum,\n\t\t\t\t\t\t\t[mapsTo]:\n\t\t\t\t\t\t\t\tdatum[mapsTo] === null\n\t\t\t\t\t\t\t\t\t? datum[mapsTo]\n\t\t\t\t\t\t\t\t\t: Number(datum[mapsTo]),\n\t\t\t\t\t\t};\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\t// Check for custom domain\n\t\t\t\tif (mapsTo && axesOptions[axis].domain) {\n\t\t\t\t\tif (scaleType === ScaleTypes.LABELS) {\n\t\t\t\t\t\tallData = allData.filter((datum) =>\n\t\t\t\t\t\t\taxesOptions[axis].domain.includes(datum[mapsTo])\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst [start, end] = axesOptions[axis].domain;\n\t\t\t\t\t\t// Filter out data outside domain if that datapoint is using that axis (has mapsTo property)\n\t\t\t\t\t\tallData = allData.filter(\n\t\t\t\t\t\t\t(datum) =>\n\t\t\t\t\t\t\t\t!(mapsTo in datum) ||\n\t\t\t\t\t\t\t\t(datum[mapsTo] >= start && datum[mapsTo] <= end)\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\treturn allData.filter((datum) => {\n\t\t\treturn dataGroups.find(\n\t\t\t\t(group) => group.name === datum[groupMapsTo]\n\t\t\t);\n\t\t});\n\t}\n\n\t/**\n\t * Charts that have group configs passed into them, only want to retrieve the display data relevant to that chart\n\t * @param groups the included datasets for the particular chart\n\t */\n\tgetDisplayData(groups?) {\n\t\tif (!this.get('data')) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst { ACTIVE } = Configuration.legend.items.status;\n\t\tconst dataGroups = this.getDataGroups(groups);\n\t\tconst { groupMapsTo } = this.getOptions().data;\n\t\tconst allDataFromDomain = this.getAllDataFromDomain(groups);\n\n\t\treturn allDataFromDomain.filter((datum) => {\n\t\t\treturn dataGroups.find(\n\t\t\t\t(dataGroup) =>\n\t\t\t\t\tdataGroup.name === datum[groupMapsTo] &&\n\t\t\t\t\tdataGroup.status === ACTIVE\n\t\t\t);\n\t\t});\n\t}\n\n\tgetData() {\n\t\treturn this.get('data');\n\t}\n\n\tisDataEmpty() {\n\t\treturn !this.getData().length;\n\t}\n\n\t/**\n\t *\n\t * @param newData The new raw data to be set\n\t */\n\tsetData(newData) {\n\t\tconst sanitizedData = this.sanitize(Tools.clone(newData));\n\t\tconst dataGroups = this.generateDataGroups(sanitizedData);\n\n\t\tthis.set({\n\t\t\tdata: sanitizedData,\n\t\t\tdataGroups,\n\t\t});\n\n\t\treturn sanitizedData;\n\t}\n\n\tgetDataGroups(groups?) {\n\t\tconst isDataLoading = Tools.getProperty(\n\t\t\tthis.getOptions(),\n\t\t\t'data',\n\t\t\t'loading'\n\t\t);\n\n\t\t// No data should be displayed while data is still loading\n\t\tif (isDataLoading) {\n\t\t\treturn [];\n\t\t}\n\n\t\t// if its a combo chart, the specific chart will pass the model the groups it needs\n\t\tif (groups) {\n\t\t\treturn this.get('dataGroups').filter((dataGroup) =>\n\t\t\t\tgroups.includes(dataGroup.name)\n\t\t\t);\n\t\t}\n\t\treturn this.get('dataGroups');\n\t}\n\n\tgetActiveDataGroups(groups?) {\n\t\tconst { ACTIVE } = Configuration.legend.items.status;\n\n\t\treturn this.getDataGroups(groups).filter(\n\t\t\t(dataGroup) => dataGroup.status === ACTIVE\n\t\t);\n\t}\n\n\tgetDataGroupNames(groups?) {\n\t\tconst dataGroups = this.getDataGroups(groups);\n\t\treturn dataGroups.map((dataGroup) => dataGroup.name);\n\t}\n\n\tgetActiveDataGroupNames(groups?) {\n\t\tconst activeDataGroups = this.getActiveDataGroups(groups);\n\t\treturn activeDataGroups.map((dataGroup) => dataGroup.name);\n\t}\n\n\tprivate aggregateBinDataByGroup(bin) {\n\t\treturn Tools.groupBy(bin, 'group');\n\t}\n\n\tgetBinConfigurations() {\n\t\t// Manipulate data and options for Histogram\n\t\tconst data = this.getDisplayData();\n\t\tconst options = this.getOptions();\n\n\t\tconst mainXPos = this.services.cartesianScales.getMainXAxisPosition();\n\t\tconst domainIdentifier = this.services.cartesianScales.getDomainIdentifier();\n\n\t\tconst axisOptions = options.axes[mainXPos];\n\t\tconst { groupMapsTo } = options.data;\n\t\tconst { bins: axisBins = histogramConfigs.defaultBins } = axisOptions;\n\t\tconst areBinsDefined = Array.isArray(axisBins);\n\n\t\t// Get Histogram bins\n\t\tconst bins = histogram()\n\t\t\t.value((d) => d[domainIdentifier])\n\t\t\t.thresholds(axisBins)(data);\n\n\t\tif (!areBinsDefined) {\n\t\t\t// If bins are not defined by user\n\t\t\tconst binsWidth = bins[0].x1 - bins[0].x0;\n\t\t\t// Set last bin width as the others\n\t\t\tbins[bins.length - 1].x1 = +bins[bins.length - 1].x0 + binsWidth;\n\t\t} else {\n\t\t\t// Set last bin end as the last user defined one\n\t\t\tbins[bins.length - 1].x1 = axisBins[axisBins.length - 1];\n\t\t}\n\n\t\tconst binsDomain = areBinsDefined\n\t\t\t? [axisBins[0], axisBins[axisBins.length - 1]]\n\t\t\t: [bins[0].x0, bins[bins.length - 1].x1];\n\n\t\t// Get all groups\n\t\tconst groupsKeys = Array.from(new Set(data.map((d) => d[groupMapsTo])));\n\n\t\tconst histogramData = [];\n\n\t\t// Group data by bin\n\t\tbins.forEach((bin) => {\n\t\t\tconst key = `${bin.x0}-${bin.x1}`;\n\t\t\tconst aggregateDataByGroup = this.aggregateBinDataByGroup(bin);\n\n\t\t\tgroupsKeys.forEach((group: string) => {\n\t\t\t\t// For each dataset put a bin with value 0 if not exist\n\t\t\t\t// (Scale X won't change when changing showed datasets)\n\t\t\t\thistogramData.push({\n\t\t\t\t\tgroup,\n\t\t\t\t\tkey,\n\t\t\t\t\tvalue: aggregateDataByGroup[group] || 0,\n\t\t\t\t\tbin: bin.x0,\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\n\t\treturn {\n\t\t\tbins,\n\t\t\tbinsDomain,\n\t\t};\n\t}\n\n\tgetBinnedStackedData() {\n\t\tconst options = this.getOptions();\n\t\tconst { groupMapsTo } = options.data;\n\n\t\tconst dataGroupNames = this.getActiveDataGroupNames();\n\n\t\tconst { bins } = this.getBinConfigurations();\n\t\tconst dataValuesGroupedByKeys = this.getDataValuesGroupedByKeys({\n\t\t\tbins,\n\t\t});\n\n\t\treturn stack()\n\t\t\t.keys(dataGroupNames)(dataValuesGroupedByKeys)\n\t\t\t.map((series, i) => {\n\t\t\t\t// Add data group names to each series\n\t\t\t\treturn Object.keys(series)\n\t\t\t\t\t.filter((key: any) => !isNaN(key))\n\t\t\t\t\t.map((key) => {\n\t\t\t\t\t\tconst element = series[key];\n\t\t\t\t\t\telement[groupMapsTo] = dataGroupNames[i];\n\n\t\t\t\t\t\treturn element;\n\t\t\t\t\t});\n\t\t\t});\n\t}\n\n\tgetGroupedData(groups?) {\n\t\tconst displayData = this.getDisplayData(groups);\n\t\tconst groupedData = {};\n\t\tconst { groupMapsTo } = this.getOptions().data;\n\n\t\tdisplayData.map((datum) => {\n\t\t\tconst group = datum[groupMapsTo];\n\t\t\tif (\n\t\t\t\tgroupedData[group] !== null &&\n\t\t\t\tgroupedData[group] !== undefined\n\t\t\t) {\n\t\t\t\tgroupedData[group].push(datum);\n\t\t\t} else {\n\t\t\t\tgroupedData[group] = [datum];\n\t\t\t}\n\t\t});\n\n\t\treturn Object.keys(groupedData).map((groupName) => ({\n\t\t\tname: groupName,\n\t\t\tdata: groupedData[groupName],\n\t\t}));\n\t}\n\n\tgetStackKeys(\n\t\t{ bins = null, groups = null } = { bins: null, groups: null }\n\t) {\n\t\tconst options = this.getOptions();\n\n\t\tconst displayData = this.getDisplayData(groups);\n\n\t\tlet stackKeys;\n\t\tif (bins) {\n\t\t\tstackKeys = bins.map((bin) => `${bin.x0}-${bin.x1}`);\n\t\t} else {\n\t\t\tstackKeys = Tools.removeArrayDuplicates(\n\t\t\t\tdisplayData.map((datum) => {\n\t\t\t\t\tconst domainIdentifier = this.services.cartesianScales.getDomainIdentifier(\n\t\t\t\t\t\tdatum\n\t\t\t\t\t);\n\n\t\t\t\t\t// Use time value as key for Date object to avoid multiple data in the same second\n\t\t\t\t\tif (datum[domainIdentifier] instanceof Date) {\n\t\t\t\t\t\treturn formatDateTillMilliSeconds(\n\t\t\t\t\t\t\tdatum[domainIdentifier]\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn datum[domainIdentifier] &&\n\t\t\t\t\t\ttypeof datum[domainIdentifier].toString === 'function'\n\t\t\t\t\t\t? datum[domainIdentifier].toString()\n\t\t\t\t\t\t: datum[domainIdentifier];\n\t\t\t\t})\n\t\t\t);\n\t\t}\n\n\t\tconst axisPosition = this.services.cartesianScales.domainAxisPosition;\n\t\tconst scaleType = options.axes[axisPosition].scaleType;\n\n\t\t// Sort keys\n\t\tif (scaleType === ScaleTypes.TIME) {\n\t\t\tstackKeys.sort((a: any, b: any) => {\n\t\t\t\tconst dateA: any = new Date(a);\n\t\t\t\tconst dateB: any = new Date(b);\n\n\t\t\t\treturn dateA - dateB;\n\t\t\t});\n\t\t} else if (\n\t\t\tscaleType === ScaleTypes.LOG ||\n\t\t\tscaleType === ScaleTypes.LINEAR\n\t\t) {\n\t\t\tstackKeys.sort((a: any, b: any) => a - b);\n\t\t}\n\n\t\treturn stackKeys;\n\t}\n\n\tgetDataValuesGroupedByKeys({ bins = null, groups = null }) {\n\t\tconst options = this.getOptions();\n\t\tconst { groupMapsTo } = options.data;\n\t\tconst displayData = this.getDisplayData(groups);\n\n\t\tconst dataGroupNames = this.getDataGroupNames();\n\n\t\tconst stackKeys = this.getStackKeys({ bins, groups });\n\t\tif (bins) {\n\t\t\treturn stackKeys.map((key) => {\n\t\t\t\tconst [binStart, binEnd] = key.split('-');\n\n\t\t\t\tconst correspondingValues = { x0: binStart, x1: binEnd };\n\t\t\t\tconst correspondingBin = bins.find(\n\t\t\t\t\t(bin) => bin.x0.toString() === binStart.toString()\n\t\t\t\t);\n\n\t\t\t\tdataGroupNames.forEach((dataGroupName) => {\n\t\t\t\t\tcorrespondingValues[\n\t\t\t\t\t\tdataGroupName\n\t\t\t\t\t] = correspondingBin.filter(\n\t\t\t\t\t\t(binItem) => binItem[groupMapsTo] === dataGroupName\n\t\t\t\t\t).length;\n\t\t\t\t});\n\n\t\t\t\treturn correspondingValues;\n\t\t\t}) as any;\n\t\t}\n\n\t\treturn stackKeys.map((key) => {\n\t\t\tconst correspondingValues = { sharedStackKey: key };\n\t\t\tdataGroupNames.forEach((dataGroupName) => {\n\t\t\t\tconst correspondingDatum = displayData.find((datum) => {\n\t\t\t\t\tconst domainIdentifier = this.services.cartesianScales.getDomainIdentifier(\n\t\t\t\t\t\tdatum\n\t\t\t\t\t);\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\tdatum[groupMapsTo] === dataGroupName &&\n\t\t\t\t\t\tdatum.hasOwnProperty(domainIdentifier) &&\n\t\t\t\t\t\t(datum[domainIdentifier] instanceof Date\n\t\t\t\t\t\t\t? formatDateTillMilliSeconds(\n\t\t\t\t\t\t\t\t\tdatum[domainIdentifier]\n\t\t\t\t\t\t\t ) === key\n\t\t\t\t\t\t\t: datum[domainIdentifier].toString() === key)\n\t\t\t\t\t);\n\t\t\t\t});\n\n\t\t\t\tconst rangeIdentifier = this.services.cartesianScales.getRangeIdentifier(\n\t\t\t\t\tcorrespondingValues\n\t\t\t\t);\n\t\t\t\tcorrespondingValues[dataGroupName] = correspondingDatum\n\t\t\t\t\t? correspondingDatum[rangeIdentifier]\n\t\t\t\t\t: null;\n\t\t\t});\n\n\t\t\treturn correspondingValues;\n\t\t}) as any;\n\t}\n\n\tgetStackedData({ percentage = false, groups = null, divergent = false }) {\n\t\tconst options = this.getOptions();\n\t\tconst { groupMapsTo } = options.data;\n\n\t\t// Get only active data groups so non-active data groups are not rendered\n\t\t// on legend item click\n\t\tconst dataGroupNames = this.getActiveDataGroupNames(groups);\n\t\tconst dataValuesGroupedByKeys = this.getDataValuesGroupedByKeys({\n\t\t\tgroups,\n\t\t});\n\n\t\tif (percentage) {\n\t\t\tconst maxByKey = Tools.fromPairs(\n\t\t\t\tdataValuesGroupedByKeys.map((d: any) => [d.sharedStackKey, 0])\n\t\t\t);\n\n\t\t\tdataValuesGroupedByKeys.forEach((d: any) => {\n\t\t\t\tdataGroupNames.forEach((name) => {\n\t\t\t\t\tmaxByKey[d.sharedStackKey] += d[name];\n\t\t\t\t});\n\t\t\t});\n\n\t\t\t// cycle through data values to get percentage\n\t\t\tdataValuesGroupedByKeys.forEach((d: any) => {\n\t\t\t\tdataGroupNames.forEach((name) => {\n\t\t\t\t\tif (maxByKey[d.sharedStackKey]) {\n\t\t\t\t\t\td[name] = (d[name] / maxByKey[d.sharedStackKey]) * 100;\n\t\t\t\t\t} else {\n\t\t\t\t\t\td[name] = 0;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n\t\t}\n\n\t\tconst stackToUse = divergent\n\t\t\t? stack().offset(stackOffsetDiverging)\n\t\t\t: stack();\n\n\t\treturn stackToUse\n\t\t\t.keys(dataGroupNames)(dataValuesGroupedByKeys)\n\t\t\t.map((series, i) => {\n\t\t\t\t// Add data group names to each series\n\t\t\t\treturn Object.keys(series)\n\t\t\t\t\t.filter((key: any) => !isNaN(key))\n\t\t\t\t\t.map((key) => {\n\t\t\t\t\t\tconst element = series[key];\n\t\t\t\t\t\telement[groupMapsTo] = dataGroupNames[i];\n\n\t\t\t\t\t\treturn element;\n\t\t\t\t\t});\n\t\t\t});\n\t}\n\n\t/**\n\t * @return {Object} The chart's options\n\t */\n\tgetOptions() {\n\t\treturn this.state.options;\n\t}\n\n\tset(newState: any, configs?: any) {\n\t\tthis.state = Object.assign({}, this.state, newState);\n\t\tconst newConfig = Object.assign(\n\t\t\t{ skipUpdate: false, animate: true }, // default configs\n\t\t\tconfigs\n\t\t);\n\t\tif (!newConfig.skipUpdate) {\n\t\t\tthis.update(newConfig.animate);\n\t\t}\n\t}\n\n\tget(property?: string) {\n\t\tif (property) {\n\t\t\treturn this.state[property];\n\t\t} else {\n\t\t\treturn this.state;\n\t\t}\n\t}\n\n\t/**\n\t *\n\t * @param newOptions New options to be set\n\t */\n\tsetOptions(newOptions) {\n\t\tconst options = this.getOptions();\n\t\tTools.updateLegendAdditionalItems(options, newOptions);\n\n\t\tthis.set({\n\t\t\toptions: Tools.merge(options, newOptions),\n\t\t});\n\t}\n\n\t/**\n\t *\n\t * Updates miscellanous information within the model\n\t * such as the color scales, or the legend data labels\n\t */\n\tupdate(animate = true) {\n\t\tif (!this.getDisplayData()) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.updateAllDataGroups();\n\n\t\tthis.setCustomColorScale();\n\t\tthis.setColorClassNames();\n\t\tthis.services.events.dispatchEvent(Events.Model.UPDATE, { animate });\n\t}\n\n\t/*\n\t * Data labels\n\t */\n\ttoggleDataLabel(changedLabel: string) {\n\t\tconst { ACTIVE, DISABLED } = Configuration.legend.items.status;\n\t\tconst dataGroups = this.getDataGroups();\n\n\t\tconst hasDeactivatedItems = dataGroups.some(\n\t\t\t(group) => group.status === DISABLED\n\t\t);\n\t\tconst activeItems = dataGroups.filter(\n\t\t\t(group) => group.status === ACTIVE\n\t\t);\n\n\t\t// If there are deactivated items, toggle \"changedLabel\"\n\t\tif (hasDeactivatedItems) {\n\t\t\t// If the only active item is being toggled\n\t\t\t// Activate all items\n\t\t\tif (\n\t\t\t\tactiveItems.length === 1 &&\n\t\t\t\tactiveItems[0].name === changedLabel\n\t\t\t) {\n\t\t\t\t// If every item is active, then enable \"changedLabel\" and disable all other items\n\t\t\t\tdataGroups.forEach((group, i) => {\n\t\t\t\t\tdataGroups[i].status = ACTIVE;\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tconst indexToChange = dataGroups.findIndex(\n\t\t\t\t\t(group) => group.name === changedLabel\n\t\t\t\t);\n\t\t\t\tdataGroups[indexToChange].status =\n\t\t\t\t\tdataGroups[indexToChange].status === DISABLED\n\t\t\t\t\t\t? ACTIVE\n\t\t\t\t\t\t: DISABLED;\n\t\t\t}\n\t\t} else {\n\t\t\t// If every item is active, then enable \"changedLabel\" and disable all other items\n\t\t\tdataGroups.forEach((group, i) => {\n\t\t\t\tdataGroups[i].status =\n\t\t\t\t\tgroup.name === changedLabel ? ACTIVE : DISABLED;\n\t\t\t});\n\t\t}\n\n\t\t// Updates selected groups\n\t\tconst updatedActiveItems = dataGroups.filter(\n\t\t\t(group) => group.status === ACTIVE\n\t\t);\n\t\tconst options = this.getOptions();\n\n\t\tconst hasUpdatedDeactivatedItems = dataGroups.some(\n\t\t\t(group) => group.status === DISABLED\n\t\t);\n\n\t\t// If there are deactivated items, map the item name into selected groups\n\t\tif (hasUpdatedDeactivatedItems) {\n\t\t\toptions.data.selectedGroups = updatedActiveItems.map(\n\t\t\t\t(activeItem) => activeItem.name\n\t\t\t);\n\t\t} else {\n\t\t\t// If every item is active, clear array\n\t\t\toptions.data.selectedGroups = [];\n\t\t}\n\n\t\t// dispatch legend filtering event with the status of all the dataLabels\n\t\tthis.services.events.dispatchEvent(Events.Legend.ITEMS_UPDATE, {\n\t\t\tdataGroups,\n\t\t});\n\n\t\t// Update model\n\t\tthis.set({\n\t\t\tdataGroups,\n\t\t});\n\t}\n\n\t/**\n\t * Should the data point be filled?\n\t * @param group\n\t * @param key\n\t * @param value\n\t * @param defaultFilled the default for this chart\n\t */\n\tgetIsFilled(group: any, key?: any, data?: any, defaultFilled?: boolean) {\n\t\tconst options = this.getOptions();\n\t\tif (options.getIsFilled) {\n\t\t\treturn options.getIsFilled(group, key, data, defaultFilled);\n\t\t} else {\n\t\t\treturn defaultFilled;\n\t\t}\n\t}\n\n\tgetFillColor(group: any, key?: any, data?: any) {\n\t\tconst options = this.getOptions();\n\t\tconst defaultFillColor = Tools.getProperty(this.colorScale, group);\n\n\t\tif (options.getFillColor) {\n\t\t\treturn options.getFillColor(group, key, data, defaultFillColor);\n\t\t} else {\n\t\t\treturn defaultFillColor;\n\t\t}\n\t}\n\n\tgetStrokeColor(group: any, key?: any, data?: any) {\n\t\tconst options = this.getOptions();\n\t\tconst defaultStrokeColor = Tools.getProperty(this.colorScale, group);\n\n\t\tif (options.getStrokeColor) {\n\t\t\treturn options.getStrokeColor(group, key, data, defaultStrokeColor);\n\t\t} else {\n\t\t\treturn defaultStrokeColor;\n\t\t}\n\t}\n\n\tisUserProvidedColorScaleValid() {\n\t\tconst userProvidedScale = Tools.getProperty(\n\t\t\tthis.getOptions(),\n\t\t\t'color',\n\t\t\t'scale'\n\t\t);\n\t\tconst dataGroups = this.getDataGroups();\n\n\t\tif (\n\t\t\tuserProvidedScale == null ||\n\t\t\tObject.keys(userProvidedScale).length == 0\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn dataGroups.some((dataGroup) =>\n\t\t\tObject.keys(userProvidedScale).includes(dataGroup.name)\n\t\t);\n\t}\n\n\tgetColorClassName(configs: {\n\t\tclassNameTypes: ColorClassNameTypes[];\n\t\tdataGroupName?: string;\n\t\toriginalClassName?: string;\n\t}) {\n\t\tconst colorPairingTag = this.colorClassNames(configs.dataGroupName);\n\t\tlet className = configs.originalClassName;\n\t\tconfigs.classNameTypes.forEach(\n\t\t\t(type) =>\n\t\t\t\t(className = configs.originalClassName\n\t\t\t\t\t? `${className} ${type}-${colorPairingTag}`\n\t\t\t\t\t: `${type}-${colorPairingTag}`)\n\t\t);\n\n\t\treturn className;\n\t}\n\n\t/**\n\t * For charts that might hold an associated status for their dataset\n\t */\n\tgetStatus() {\n\t\treturn null;\n\t}\n\n\tgetAllDataGroupsNames() {\n\t\treturn this.allDataGroups;\n\t}\n\n\t/**\n\t * Converts data provided in the older format to tabular\n\t *\n\t */\n\tprotected transformToTabularData(data) {\n\t\tconsole.warn(\n\t\t\t\"We've updated the charting data format to be tabular by default. The current format you're using is deprecated and will be removed in v1.0, read more here https://carbon-design-system.github.io/carbon-charts/?path=/story/docs-tutorials--tabular-data-format\"\n\t\t);\n\t\tconst tabularData = [];\n\t\tconst { datasets, labels } = data;\n\n\t\t// Loop through all datasets\n\t\tdatasets.forEach((dataset) => {\n\t\t\t// Update each data point to the new format\n\t\t\tdataset.data.forEach((datum, i) => {\n\t\t\t\tlet group;\n\n\t\t\t\tconst datasetLabel = Tools.getProperty(dataset, 'label');\n\t\t\t\tif (datasetLabel === null) {\n\t\t\t\t\tconst correspondingLabel = Tools.getProperty(labels, i);\n\t\t\t\t\tif (correspondingLabel) {\n\t\t\t\t\t\tgroup = correspondingLabel;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tgroup = 'Ungrouped';\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tgroup = datasetLabel;\n\t\t\t\t}\n\n\t\t\t\tconst updatedDatum = {\n\t\t\t\t\tgroup,\n\t\t\t\t\tkey: labels[i],\n\t\t\t\t};\n\n\t\t\t\tif (isNaN(datum)) {\n\t\t\t\t\tupdatedDatum['value'] = datum.value;\n\t\t\t\t\tupdatedDatum['date'] = datum.date;\n\t\t\t\t} else {\n\t\t\t\t\tupdatedDatum['value'] = datum;\n\t\t\t\t}\n\n\t\t\t\ttabularData.push(updatedDatum);\n\t\t\t});\n\t\t});\n\n\t\treturn tabularData;\n\t}\n\n\tgetTabularDataArray() {\n\t\treturn [];\n\t}\n\n\texportToCSV() {\n\t\tlet data = this.getTabularDataArray().map((row) =>\n\t\t\trow.map((column) => `\\\"${column === '–' ? '–' : column}\\\"`)\n\t\t);\n\n\t\tlet csvString = '',\n\t\t\tcsvData = '';\n\t\tdata.forEach(function (d, i) {\n\t\t\tcsvData = d.join(',');\n\t\t\tcsvString += i < data.length ? csvData + '\\n' : csvData;\n\t\t});\n\n\t\tconst options = this.getOptions();\n\n\t\tlet fileName = 'myChart';\n\t\tconst customFilename = Tools.getProperty(\n\t\t\toptions,\n\t\t\t'fileDownload',\n\t\t\t'fileName'\n\t\t);\n\n\t\tif (typeof customFilename === 'function') {\n\t\t\tfileName = customFilename('csv');\n\t\t}\n\n\t\tthis.services.files.downloadCSV(csvString, `${fileName}.csv`);\n\t}\n\n\tprotected getTabularData(data) {\n\t\t// if data is not an array\n\t\tif (!Array.isArray(data)) {\n\t\t\treturn this.transformToTabularData(data);\n\t\t}\n\n\t\treturn data;\n\t}\n\n\tprotected sanitize(data) {\n\t\tdata = this.getTabularData(data);\n\n\t\treturn data;\n\t}\n\n\t/*\n\t * Data groups\n\t */\n\tprotected updateAllDataGroups() {\n\t\t// allDataGroups is used to generate a color scale that applies\n\t\t// to all the groups. Now when the data updates, you might remove a group,\n\t\t// and then bring it back in a newer data update, therefore\n\t\t// the order of the groups in allDataGroups matters so that you'd never\n\t\t// have an incorrect color assigned to a group.\n\n\t\t// Also, a new group should only be added to allDataGroups if\n\t\t// it doesn't currently exist\n\n\t\tif (!this.allDataGroups) {\n\t\t\tthis.allDataGroups = this.getDataGroupNames();\n\t\t} else {\n\t\t\t// Loop through current data groups\n\t\t\tthis.getDataGroupNames().forEach((dataGroupName) => {\n\t\t\t\t// If group name hasn't been stored yet, store it\n\t\t\t\tif (this.allDataGroups.indexOf(dataGroupName) === -1) {\n\t\t\t\t\tthis.allDataGroups.push(dataGroupName);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\tprotected generateDataGroups(data) {\n\t\tconst { groupMapsTo } = this.getOptions().data;\n\t\tconst { ACTIVE, DISABLED } = Configuration.legend.items.status;\n\t\tconst options = this.getOptions();\n\n\t\tconst uniqueDataGroups = Tools.removeArrayDuplicates(\n\t\t\tdata.map((datum) => datum[groupMapsTo])\n\t\t);\n\n\t\t// check if selectedGroups can be applied to chart with current data groups\n\t\tif (options.data.selectedGroups.length) {\n\t\t\tconst hasAllSelectedGroups = options.data.selectedGroups.every(\n\t\t\t\t(groupName) => uniqueDataGroups.includes(groupName)\n\t\t\t);\n\t\t\tif (!hasAllSelectedGroups) {\n\t\t\t\toptions.data.selectedGroups = [];\n\t\t\t}\n\t\t}\n\n\t\t// Get group status based on items in selected groups\n\t\tconst getStatus = (groupName) =>\n\t\t\t!options.data.selectedGroups.length ||\n\t\t\toptions.data.selectedGroups.includes(groupName)\n\t\t\t\t? ACTIVE\n\t\t\t\t: DISABLED;\n\n\t\treturn uniqueDataGroups.map((groupName) => ({\n\t\t\tname: groupName,\n\t\t\tstatus: getStatus(groupName),\n\t\t}));\n\t}\n\n\t/*\n\t * Fill scales\n\t */\n\tprotected setCustomColorScale() {\n\t\tif (!this.isUserProvidedColorScaleValid()) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst options = this.getOptions();\n\t\tconst userProvidedScale = Tools.getProperty(options, 'color', 'scale');\n\n\t\tObject.keys(userProvidedScale).forEach((dataGroup) => {\n\t\t\tif (!this.allDataGroups.includes(dataGroup)) {\n\t\t\t\tconsole.warn(`\"${dataGroup}\" does not exist in data groups.`);\n\t\t\t}\n\t\t});\n\n\t\t/**\n\t\t * Go through allDataGroups. If a data group has a color value provided\n\t\t * by the user, add that to the color range\n\t\t */\n\t\tconst providedDataGroups = this.allDataGroups.filter(\n\t\t\t(dataGroup) => userProvidedScale[dataGroup]\n\t\t);\n\n\t\tprovidedDataGroups.forEach(\n\t\t\t(dataGroup) =>\n\t\t\t\t(this.colorScale[dataGroup] = userProvidedScale[dataGroup])\n\t\t);\n\t}\n\n\t/*\n\t * Color palette\n\t */\n\tprotected setColorClassNames() {\n\t\tconst colorPairingOptions = Tools.getProperty(\n\t\t\tthis.getOptions(),\n\t\t\t'color',\n\t\t\t'pairing'\n\t\t);\n\n\t\t// Check if user has defined numberOfVariants (differ from given data)\n\t\tlet numberOfVariants = Tools.getProperty(\n\t\t\tcolorPairingOptions,\n\t\t\t'numberOfVariants'\n\t\t);\n\t\tif (!numberOfVariants || numberOfVariants < this.allDataGroups.length) {\n\t\t\tnumberOfVariants = this.allDataGroups.length;\n\t\t}\n\n\t\tlet pairingOption = Tools.getProperty(colorPairingOptions, 'option');\n\t\tconst colorPairingCounts = Configuration.color.pairingOptions;\n\n\t\t// If number of dataGroups is greater than 5, user 14-color palette\n\t\tconst numberOfColors = numberOfVariants > 5 ? 14 : numberOfVariants;\n\n\t\t// Use default palette if user choice is not in range\n\t\tpairingOption =\n\t\t\tpairingOption <= colorPairingCounts[`${numberOfColors}-color`]\n\t\t\t\t? pairingOption\n\t\t\t\t: 1;\n\n\t\t// Create color classes for graph, tooltip and stroke use\n\t\tconst colorPairing = this.allDataGroups.map(\n\t\t\t(dataGroup, index) =>\n\t\t\t\t`${numberOfColors}-${pairingOption}-${(index % 14) + 1}`\n\t\t);\n\n\t\t// Create default color classnames\n\t\tthis.colorClassNames = scaleOrdinal()\n\t\t\t.range(colorPairing)\n\t\t\t.domain(this.allDataGroups);\n\t}\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carbon/charts",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.1",
|
|
4
4
|
"description": "Carbon charting components",
|
|
5
5
|
"main": "./bundle.js",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -48,10 +48,10 @@
|
|
|
48
48
|
"author": "IBM",
|
|
49
49
|
"license": "Apache-2.0",
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@carbon/styles": "^1.
|
|
52
|
-
"@carbon/telemetry": "0.1.0",
|
|
53
|
-
"@carbon/utils-position": "1.1.
|
|
54
|
-
"carbon-components": "^10.
|
|
51
|
+
"@carbon/styles": "^1.26.0",
|
|
52
|
+
"@carbon/telemetry": "^0.1.0",
|
|
53
|
+
"@carbon/utils-position": "^1.1.4",
|
|
54
|
+
"carbon-components": "^10.58.3",
|
|
55
55
|
"d3-cloud": "1.2.5",
|
|
56
56
|
"d3-sankey": "0.12.3",
|
|
57
57
|
"date-fns": "2.8.1",
|
|
@@ -62,14 +62,14 @@
|
|
|
62
62
|
"d3": "7.x"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
|
-
"@carbon/colors": "^11.
|
|
66
|
-
"@carbon/elements": "11.
|
|
67
|
-
"@carbon/grid": "11.
|
|
68
|
-
"@carbon/import-once": "10.7.0",
|
|
69
|
-
"@carbon/layout": "11.
|
|
70
|
-
"@carbon/motion": "11.
|
|
71
|
-
"@carbon/themes": "11.
|
|
72
|
-
"@carbon/type": "11.
|
|
65
|
+
"@carbon/colors": "^11.13.0",
|
|
66
|
+
"@carbon/elements": "^11.20.0",
|
|
67
|
+
"@carbon/grid": "^11.12.0",
|
|
68
|
+
"@carbon/import-once": "^10.7.0",
|
|
69
|
+
"@carbon/layout": "^11.12.0",
|
|
70
|
+
"@carbon/motion": "^11.10.0",
|
|
71
|
+
"@carbon/themes": "^11.17.0",
|
|
72
|
+
"@carbon/type": "^11.16.0",
|
|
73
73
|
"@rollup/plugin-json": "4.0.2",
|
|
74
74
|
"@rollup/plugin-replace": "3.0.0",
|
|
75
75
|
"@storybook/addon-knobs": "5.3.12",
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"@types/d3": "7.0.0",
|
|
80
80
|
"@types/jasmine": "2.8.7",
|
|
81
81
|
"@types/karma": "3.0.2",
|
|
82
|
-
"@types/node": "12.
|
|
82
|
+
"@types/node": "^12.0.0",
|
|
83
83
|
"babel-core": "6.26.0",
|
|
84
84
|
"babel-loader": "7.1.2",
|
|
85
85
|
"babel-polyfill": "6.26.0",
|
|
@@ -88,6 +88,7 @@
|
|
|
88
88
|
"copy-webpack-plugin": "4.5.2",
|
|
89
89
|
"css-loader": "0.28.7",
|
|
90
90
|
"d3": "7.0.0",
|
|
91
|
+
"dom-to-image-more": "^3.1.4",
|
|
91
92
|
"extract-text-webpack-plugin": "3.0.2",
|
|
92
93
|
"file-loader": "1.1.5",
|
|
93
94
|
"fork-ts-checker-webpack-plugin": "^4.0.5",
|
|
@@ -21,7 +21,7 @@ import * as Tools from '../../tools';
|
|
|
21
21
|
import { carbonPrefix } from '../../configuration-non-customizable';
|
|
22
22
|
// MISC
|
|
23
23
|
import ResizeObserver from 'resize-observer-polyfill';
|
|
24
|
-
import domToImage from '
|
|
24
|
+
import domToImage from 'dom-to-image-more';
|
|
25
25
|
var CSS_VERIFIER_ELEMENT_CLASSNAME = 'DONT_STYLE_ME_css_styles_verifier';
|
|
26
26
|
var DOMUtils = /** @class */ (function (_super) {
|
|
27
27
|
__extends(DOMUtils, _super);
|
|
@@ -222,6 +222,7 @@ var DOMUtils = /** @class */ (function (_super) {
|
|
|
222
222
|
};
|
|
223
223
|
DOMUtils.prototype.exportToJPG = function () {
|
|
224
224
|
var self = this;
|
|
225
|
+
var options = this.model.getOptions();
|
|
225
226
|
var holder = this.getHolder();
|
|
226
227
|
var holderSelection = select(holder);
|
|
227
228
|
holderSelection.classed('filled', true);
|
|
@@ -243,12 +244,18 @@ var DOMUtils = /** @class */ (function (_super) {
|
|
|
243
244
|
},
|
|
244
245
|
})
|
|
245
246
|
.then(function (dataUrl) {
|
|
246
|
-
|
|
247
|
+
var fileName = 'myChart';
|
|
248
|
+
var customFilename = Tools.getProperty(options, 'fileDownload', 'fileName');
|
|
249
|
+
if (typeof customFilename === 'function') {
|
|
250
|
+
fileName = customFilename('jpg');
|
|
251
|
+
}
|
|
252
|
+
self.services.files.downloadImage(dataUrl, fileName + ".jpg");
|
|
247
253
|
holderSelection.classed('filled', false);
|
|
248
254
|
});
|
|
249
255
|
};
|
|
250
256
|
DOMUtils.prototype.exportToPNG = function () {
|
|
251
257
|
var self = this;
|
|
258
|
+
var options = this.model.getOptions();
|
|
252
259
|
var holder = this.getHolder();
|
|
253
260
|
var holderSelection = select(holder);
|
|
254
261
|
holderSelection.classed('filled', true);
|
|
@@ -270,7 +277,12 @@ var DOMUtils = /** @class */ (function (_super) {
|
|
|
270
277
|
},
|
|
271
278
|
})
|
|
272
279
|
.then(function (dataUrl) {
|
|
273
|
-
|
|
280
|
+
var fileName = 'myChart';
|
|
281
|
+
var customFilename = Tools.getProperty(options, 'fileDownload', 'fileName');
|
|
282
|
+
if (typeof customFilename === 'function') {
|
|
283
|
+
fileName = customFilename('png');
|
|
284
|
+
}
|
|
285
|
+
self.services.files.downloadImage(dataUrl, fileName + ".png");
|
|
274
286
|
holderSelection.classed('filled', false);
|
|
275
287
|
})
|
|
276
288
|
.catch(function (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version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B,KAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAC3D,CAAC,CAAC,CAAC;IACL,CAAC;IAED,oCAAiB,GAAjB;QAAA,iBA+BC;QA9BA,IAAM,MAAM,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;QAEhC,IAAI,CAAC,MAAM,EAAE;YACZ,OAAO;SACP;QAED,8CAA8C;QAC9C,IAAI,cAAc,GAAG,MAAM,CAAC,WAAW,CAAC;QACxC,IAAI,eAAe,GAAG,MAAM,CAAC,YAAY,CAAC;QAE1C,+BAA+B;QAC/B,IAAM,cAAc,GAAG,KAAK,CAAC,QAAQ,CAAC,UAAC,OAAO,EAAE,QAAQ;YACvD,IAAI,CAAC,MAAM,EAAE;gBACZ,OAAO;aACP;YAED,IACC,IAAI,CAAC,GAAG,CAAC,cAAc,GAAG,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC;gBACjD,IAAI,CAAC,GAAG,CAAC,eAAe,GAAG,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,EAClD;gBACD,cAAc,GAAG,MAAM,CAAC,WAAW,CAAC;gBACpC,eAAe,GAAG,MAAM,CAAC,YAAY,CAAC;gBAEtC,KAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;aACxD;QACF,CAAC,EAAE,IAAI,CAAC,CAAC;QAET,kDAAkD;QAClD,IAAM,cAAc,GAAG,IAAI,cAAc,CAAC,cAAc,CAAC,CAAC;QAC1D,cAAc,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC;IACF,eAAC;AAAD,CAAC,AAleD,CAA8B,OAAO,GAkepC","sourcesContent":["// Internal Imports\nimport { Service } from '../service';\nimport { Events } from './../../interfaces';\n\n// D3 Imports\nimport { select, Selection } from 'd3-selection';\nimport * as Tools from '../../tools';\n\n// import the settings for the css prefix\nimport { carbonPrefix } from '../../configuration-non-customizable';\n\n// MISC\nimport ResizeObserver from 'resize-observer-polyfill';\n\nimport domToImage from './dom-to-image';\n\nconst CSS_VERIFIER_ELEMENT_CLASSNAME = 'DONT_STYLE_ME_css_styles_verifier';\n\ninterface getSVGElementSizeOptions {\n\tuseAttrs?: boolean;\n\tuseClientDimensions?: boolean;\n\tuseBBox?: boolean;\n\tuseBoundingRect?: boolean;\n}\n\nexport class DOMUtils extends Service {\n\t// Initialized in init\n\tprivate chartID;\n\n\tconstructor(model: any, services: any) {\n\t\tsuper(model, services);\n\t}\n\n\tstatic getHTMLElementSize(element: HTMLElement) {\n\t\treturn {\n\t\t\twidth: element.clientWidth,\n\t\t\theight: element.clientHeight,\n\t\t};\n\t}\n\n\tstatic getSVGElementSize(\n\t\tsvgSelector: Selection<any, any, any, any>,\n\t\toptions: getSVGElementSizeOptions = {\n\t\t\tuseAttrs: false,\n\t\t\tuseClientDimensions: false,\n\t\t\tuseBBox: false,\n\t\t\tuseBoundingRect: false,\n\t\t}\n\t) {\n\t\tif (!svgSelector.attr) {\n\t\t\tsvgSelector = select(svgSelector as any);\n\t\t}\n\n\t\tconst finalDimensions = {\n\t\t\twidth: 0,\n\t\t\theight: 0,\n\t\t};\n\n\t\tconst validateAndSetDimensions = (dimensions) => {\n\t\t\tif (dimensions) {\n\t\t\t\tObject.keys(finalDimensions).forEach((dimensionKey) => {\n\t\t\t\t\tif (dimensions[dimensionKey]) {\n\t\t\t\t\t\tconst dimension = dimensions[dimensionKey];\n\t\t\t\t\t\tconst dimensionNumber = parseFloat(dimension);\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tdimension &&\n\t\t\t\t\t\t\tdimensionNumber > finalDimensions[dimensionKey] &&\n\t\t\t\t\t\t\t('' + dimension).indexOf('%') === -1\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tfinalDimensions[dimensionKey] = dimensionNumber;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t};\n\n\t\tconst attrDimensions = {\n\t\t\twidth: svgSelector.attr('width'),\n\t\t\theight: svgSelector.attr('height'),\n\t\t};\n\n\t\tlet bbox, bboxDimensions, boundingRect, boundingRectDimensions;\n\t\t// In many versions of Firefox\n\t\t// getBBox will cause an \"NSFailure\" error\n\t\ttry {\n\t\t\tbbox = svgSelector.node().getBBox();\n\t\t\tbboxDimensions = {\n\t\t\t\twidth: bbox.width,\n\t\t\t\theight: bbox.height,\n\t\t\t};\n\t\t} catch (e) {}\n\n\t\ttry {\n\t\t\tboundingRect = svgSelector.node().getBoundingClientRect();\n\t\t\tboundingRectDimensions = {\n\t\t\t\twidth: boundingRect.width,\n\t\t\t\theight: boundingRect.height,\n\t\t\t};\n\t\t} catch (e) {}\n\n\t\tconst clientDimensions = {\n\t\t\twidth: svgSelector.node().clientWidth,\n\t\t\theight: svgSelector.node().clientHeight,\n\t\t};\n\n\t\t// If both attribute values are numbers\n\t\t// And not percentages or NaN\n\t\tif (options) {\n\t\t\tif (options.useAttrs) {\n\t\t\t\tvalidateAndSetDimensions(attrDimensions);\n\n\t\t\t\tif (finalDimensions.width > 0 && finalDimensions.height > 0) {\n\t\t\t\t\treturn finalDimensions;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (options.useClientDimensions) {\n\t\t\t\tvalidateAndSetDimensions(clientDimensions);\n\n\t\t\t\tif (finalDimensions.width > 0 && finalDimensions.height > 0) {\n\t\t\t\t\treturn clientDimensions;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (options.useBBox) {\n\t\t\t\tvalidateAndSetDimensions(bboxDimensions);\n\n\t\t\t\tif (finalDimensions.width > 0 && finalDimensions.height > 0) {\n\t\t\t\t\treturn bboxDimensions;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (options.useBoundingRect) {\n\t\t\t\tvalidateAndSetDimensions(boundingRectDimensions);\n\n\t\t\t\tif (finalDimensions.width > 0 && finalDimensions.height > 0) {\n\t\t\t\t\treturn boundingRectDimensions;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\ttry {\n\t\t\tconst nativeDimensions = {\n\t\t\t\twidth: Tools.getProperty(\n\t\t\t\t\tsvgSelector.node(),\n\t\t\t\t\t'width',\n\t\t\t\t\t'baseVal',\n\t\t\t\t\t'value'\n\t\t\t\t),\n\t\t\t\theight: Tools.getProperty(\n\t\t\t\t\tsvgSelector.node(),\n\t\t\t\t\t'height',\n\t\t\t\t\t'baseVal',\n\t\t\t\t\t'value'\n\t\t\t\t),\n\t\t\t};\n\n\t\t\tvalidateAndSetDimensions(nativeDimensions);\n\t\t} catch (e) {\n\t\t\tvalidateAndSetDimensions(clientDimensions);\n\t\t\tvalidateAndSetDimensions(bboxDimensions);\n\t\t\tvalidateAndSetDimensions(attrDimensions);\n\t\t}\n\n\t\treturn finalDimensions;\n\t}\n\n\tstatic appendOrSelect(parent, query) {\n\t\tconst selection = parent.select(`${query}`);\n\n\t\tif (selection.empty()) {\n\t\t\t// see if there is an id\n\t\t\tlet querySections = query.split('#');\n\t\t\tlet elementToAppend;\n\t\t\tlet id;\n\t\t\t// if there is an id\n\t\t\tif (querySections.length === 2) {\n\t\t\t\t// take out the element to append\n\t\t\t\telementToAppend = querySections[0];\n\t\t\t\t// split it by classes\n\t\t\t\tquerySections = querySections[1].split('.');\n\t\t\t\t// the first string is the id\n\t\t\t\tid = querySections[0];\n\t\t\t} else {\n\t\t\t\tquerySections = query.split('.');\n\t\t\t\telementToAppend = querySections[0];\n\t\t\t}\n\n\t\t\treturn parent\n\t\t\t\t.append(elementToAppend)\n\t\t\t\t.attr('id', id)\n\t\t\t\t.attr('class', querySections.slice(1).join(' '));\n\t\t}\n\n\t\treturn selection;\n\t}\n\n\tprotected mainContainer: HTMLElement;\n\tprotected width: string;\n\tprotected height: string;\n\n\tinit() {\n\t\t// Add width & height to the chart holder if necessary, and add a classname\n\t\tthis.styleHolderElement();\n\n\t\t// Initialize chart ID\n\t\tthis.initializeID();\n\n\t\tthis.addMainContainer();\n\t\tthis.verifyCSSStylesBeingApplied();\n\n\t\tif (this.model.getOptions().resizable) {\n\t\t\tthis.addResizeListener();\n\t\t}\n\n\t\tthis.addHolderListeners();\n\n\t\tthis.handleFullscreenChange();\n\t}\n\n\tgetChartID() {\n\t\treturn this.chartID;\n\t}\n\n\tgenerateElementIDString(originalID) {\n\t\treturn `chart-${this.chartID}-${originalID}`;\n\t}\n\n\tprivate initializeID() {\n\t\tthis.chartID = Math.floor(\n\t\t\t(1 + Math.random()) * 0x1000000000000\n\t\t).toString(16);\n\t}\n\n\taddMainContainer() {\n\t\tconst options = this.model.getOptions();\n\t\tconst chartsprefix = Tools.getProperty(options, 'style', 'prefix');\n\n\t\tconst mainContainer = select(this.getHolder())\n\t\t\t.append('div')\n\t\t\t.classed(`${carbonPrefix}--${chartsprefix}--chart-wrapper`, true)\n\t\t\t.attr('id', `chart-${this.getChartID()}`)\n\t\t\t.style('height', '100%')\n\t\t\t.style('width', '100%');\n\n\t\tmainContainer.append('g').attr('class', CSS_VERIFIER_ELEMENT_CLASSNAME);\n\n\t\tthis.mainContainer = mainContainer.node();\n\t}\n\n\tupdate() {\n\t\tthis.styleHolderElement();\n\t}\n\n\tstyleHolderElement() {\n\t\tconst holderElement = this.getHolder() as HTMLElement;\n\n\t\t// In order for resize events to not clash with these updates\n\t\t// We'll check if the width & height values passed in options\n\t\t// Have changed, before setting them to the holder\n\t\tconst { width, height, theme } = this.model.getOptions();\n\t\tif (width !== this.width) {\n\t\t\t// Apply formatted width attribute to chart\n\t\t\tholderElement.style.width = width;\n\n\t\t\tthis.width = width;\n\t\t}\n\n\t\tif (height !== this.height) {\n\t\t\t// Apply formatted width attribute to chart\n\t\t\tholderElement.style.height = height;\n\n\t\t\tthis.height = height;\n\t\t}\n\n\t\t// Add class to chart holder\n\t\tselect(this.getHolder())\n\t\t\t.classed(`${carbonPrefix}--chart-holder`, true)\n\t\t\t.attr('data-carbon-theme', theme);\n\t}\n\n\tgetHolder() {\n\t\treturn this.model.get('holder');\n\t}\n\n\texportToJPG() {\n\t\tconst self = this;\n\n\t\tconst holder = this.getHolder();\n\t\tconst holderSelection = select(holder);\n\t\tholderSelection.classed('filled', true);\n\n\t\tdomToImage\n\t\t\t.toJpeg(this.getMainContainer(), {\n\t\t\t\tbgcolor:\n\t\t\t\t\ttypeof window !== 'undefined'\n\t\t\t\t\t\t? window\n\t\t\t\t\t\t\t\t.getComputedStyle(holder)\n\t\t\t\t\t\t\t\t.getPropertyValue('background-color')\n\t\t\t\t\t\t: undefined,\n\t\t\t\tquality: 1,\n\t\t\t\t// Remove the toolbar\n\t\t\t\tfilter: (node) => {\n\t\t\t\t\tif (\n\t\t\t\t\t\tnode.classList &&\n\t\t\t\t\t\tnode.classList.contains('cds--cc--toolbar')\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn true;\n\t\t\t\t},\n\t\t\t})\n\t\t\t.then(function (dataUrl) {\n\t\t\t\tself.services.files.downloadImage(dataUrl, 'myChart.jpg');\n\t\t\t\tholderSelection.classed('filled', false);\n\t\t\t});\n\t}\n\n\texportToPNG() {\n\t\tconst self = this;\n\n\t\tconst holder = this.getHolder();\n\t\tconst holderSelection = select(holder);\n\t\tholderSelection.classed('filled', true);\n\n\t\tdomToImage\n\t\t\t.toPng(this.getMainContainer(), {\n\t\t\t\tbgcolor:\n\t\t\t\t\ttypeof window !== 'undefined'\n\t\t\t\t\t\t? window\n\t\t\t\t\t\t\t\t.getComputedStyle(holder)\n\t\t\t\t\t\t\t\t.getPropertyValue('background-color')\n\t\t\t\t\t\t: undefined,\n\t\t\t\tquality: 1,\n\t\t\t\t// Remove the toolbar\n\t\t\t\tfilter: (node) => {\n\t\t\t\t\tif (\n\t\t\t\t\t\tnode.classList &&\n\t\t\t\t\t\tnode.classList.contains('cds--cc--toolbar')\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn true;\n\t\t\t\t},\n\t\t\t})\n\t\t\t.then(function (dataUrl) {\n\t\t\t\tself.services.files.downloadImage(dataUrl, 'myChart.png');\n\t\t\t\tholderSelection.classed('filled', false);\n\t\t\t})\n\t\t\t.catch(function (error) {\n\t\t\t\tconsole.error('oops, something went wrong!', error);\n\t\t\t});\n\t}\n\n\ttoggleFullscreen() {\n\t\tconst holder = this.getHolder();\n\t\tconst holderSelection = select(holder);\n\n\t\tconst isFullScreen = holderSelection.classed('fullscreen');\n\n\t\tif (\n\t\t\tisFullScreen &&\n\t\t\t(document.fullscreenElement ||\n\t\t\t\tdocument['webkitFullscreenElement'] ||\n\t\t\t\tdocument['mozFullScreenElement'] ||\n\t\t\t\tdocument['msFullscreenElement'])\n\t\t) {\n\t\t\t// Call the correct function depending on the browser\n\t\t\tif (document.exitFullscreen) {\n\t\t\t\tdocument.exitFullscreen();\n\t\t\t} else if (document['webkitExitFullscreen']) {\n\t\t\t\tdocument['webkitExitFullscreen']();\n\t\t\t} else if (document['mozCancelFullScreen']) {\n\t\t\t\tdocument['mozCancelFullScreen']();\n\t\t\t} else if (document['msExitFullscreen']) {\n\t\t\t\tdocument['msExitFullscreen']();\n\t\t\t}\n\t\t} else {\n\t\t\t// Call the correct function depending on the browser\n\t\t\tif (holder.requestFullscreen) {\n\t\t\t\tholder.requestFullscreen();\n\t\t\t} else if (holder.webkitRequestFullscreen) {\n\t\t\t\tholder.webkitRequestFullscreen();\n\t\t\t} else if (holder.mozRequestFullScreen) {\n\t\t\t\tholder.mozRequestFullScreen();\n\t\t\t} else if (holder.msRequestFullscreen) {\n\t\t\t\tholder.msRequestFullscreen();\n\t\t\t}\n\t\t}\n\t}\n\n\thandleFullscreenChange() {\n\t\tdocument.addEventListener('fullscreenchange', () => {\n\t\t\tconst holderSelection = select(this.getHolder());\n\t\t\tconst isFullScreen = holderSelection.classed('fullscreen');\n\n\t\t\t// Toggle the `fullscreen` classname\n\t\t\tholderSelection.classed('fullscreen', !isFullScreen);\n\t\t});\n\t}\n\n\tverifyCSSStylesBeingApplied() {\n\t\t// setTimeout is needed here since in `addSVGElement()` we're appending the\n\t\t// CSS verifier element, and need to allow some time for it to become available\n\t\t// in the DOM\n\t\tsetTimeout(() => {\n\t\t\tconst cssVerifierElement = select(this.mainContainer)\n\t\t\t\t.select(`g.${CSS_VERIFIER_ELEMENT_CLASSNAME}`)\n\t\t\t\t.node();\n\t\t\tconst computedStyles = getComputedStyle(cssVerifierElement as any);\n\t\t\tif (\n\t\t\t\tcomputedStyles.getPropertyValue('overflow') !== 'hidden' ||\n\t\t\t\tcomputedStyles.getPropertyValue('opacity') !== '0'\n\t\t\t) {\n\t\t\t\tconsole.error(\n\t\t\t\t\t'Missing CSS styles for Carbon Charts. Please read the Carbon Charts getting started guide.'\n\t\t\t\t);\n\t\t\t}\n\t\t});\n\t}\n\n\tsetSVGMaxHeight() {\n\t\t// if there is a set height on the holder, leave the chart svg height at 100%\n\t\tif (!this.model.getOptions().height) {\n\t\t\tconst { height: chartHeight } = DOMUtils.getSVGElementSize(\n\t\t\t\tselect(this.mainContainer),\n\t\t\t\t{ useBBox: true }\n\t\t\t);\n\t\t\tconst chartSVGSelector = select(this.mainContainer).attr('class');\n\t\t\tconst children = select(this.mainContainer).selectAll(\n\t\t\t\t`.${chartSVGSelector} > svg`\n\t\t\t);\n\n\t\t\t// get the height of the children SVGs (spacers, titles, etc)\n\t\t\tlet childrenHeight = 0;\n\t\t\tchildren.nodes().forEach(function (childSVG) {\n\t\t\t\tchildrenHeight += Number(\n\t\t\t\t\tDOMUtils.getSVGElementSize(select(childSVG), {\n\t\t\t\t\t\tuseBBox: true,\n\t\t\t\t\t}).height\n\t\t\t\t);\n\t\t\t});\n\n\t\t\t// set the chart svg height to the children height\n\t\t\t// forcing the chart not to take up any more space than it requires\n\t\t\tchildrenHeight <= chartHeight\n\t\t\t\t? select(this.mainContainer).attr('height', childrenHeight)\n\t\t\t\t: select(this.mainContainer).attr('height', '100%');\n\t\t}\n\t}\n\n\tgetMainContainer() {\n\t\treturn this.mainContainer;\n\t}\n\n\taddHolderListeners() {\n\t\tconst holder = this.getHolder();\n\n\t\tif (!holder) {\n\t\t\treturn;\n\t\t}\n\n\t\tselect(holder)\n\t\t\t.on('mouseover', () => {\n\t\t\t\t// Dispatch event\n\t\t\t\tthis.services.events.dispatchEvent(Events.Chart.MOUSEOVER);\n\t\t\t})\n\t\t\t.on('mouseout', () => {\n\t\t\t\t// Dispatch event\n\t\t\t\tthis.services.events.dispatchEvent(Events.Chart.MOUSEOUT);\n\t\t\t});\n\t}\n\n\taddResizeListener() {\n\t\tconst holder = this.getHolder();\n\n\t\tif (!holder) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Grab current dimensions of the chart holder\n\t\tlet containerWidth = holder.clientWidth;\n\t\tlet containerHeight = holder.clientHeight;\n\n\t\t// The resize callback function\n\t\tconst resizeCallback = Tools.debounce((entries, observer) => {\n\t\t\tif (!holder) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tMath.abs(containerWidth - holder.clientWidth) > 1 ||\n\t\t\t\tMath.abs(containerHeight - holder.clientHeight) > 1\n\t\t\t) {\n\t\t\t\tcontainerWidth = holder.clientWidth;\n\t\t\t\tcontainerHeight = holder.clientHeight;\n\n\t\t\t\tthis.services.events.dispatchEvent(Events.Chart.RESIZE);\n\t\t\t}\n\t\t}, 12.5);\n\n\t\t// Observe the behaviour of resizing on the holder\n\t\tconst resizeObserver = new ResizeObserver(resizeCallback);\n\t\tresizeObserver.observe(holder);\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"dom-utils.js","sourceRoot":"","sources":["dom-utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,mBAAmB;AACnB,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,aAAa;AACb,OAAO,EAAE,MAAM,EAAa,MAAM,cAAc,CAAC;A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EAAE,IAAI,CAAC,CAAC;QAET,kDAAkD;QAClD,IAAM,cAAc,GAAG,IAAI,cAAc,CAAC,cAAc,CAAC,CAAC;QAC1D,cAAc,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC;IACF,eAAC;AAAD,CAAC,AA1fD,CAA8B,OAAO,GA0fpC","sourcesContent":["// Internal Imports\nimport { Service } from '../service';\nimport { Events } from './../../interfaces';\n\n// D3 Imports\nimport { select, Selection } from 'd3-selection';\nimport * as Tools from '../../tools';\n\n// import the settings for the css prefix\nimport { carbonPrefix } from '../../configuration-non-customizable';\n\n// MISC\nimport ResizeObserver from 'resize-observer-polyfill';\n\nimport domToImage from 'dom-to-image-more';\n\nconst CSS_VERIFIER_ELEMENT_CLASSNAME = 'DONT_STYLE_ME_css_styles_verifier';\n\ninterface getSVGElementSizeOptions {\n\tuseAttrs?: boolean;\n\tuseClientDimensions?: boolean;\n\tuseBBox?: boolean;\n\tuseBoundingRect?: boolean;\n}\n\nexport class DOMUtils extends Service {\n\t// Initialized in init\n\tprivate chartID;\n\n\tconstructor(model: any, services: any) {\n\t\tsuper(model, services);\n\t}\n\n\tstatic getHTMLElementSize(element: HTMLElement) {\n\t\treturn {\n\t\t\twidth: element.clientWidth,\n\t\t\theight: element.clientHeight,\n\t\t};\n\t}\n\n\tstatic getSVGElementSize(\n\t\tsvgSelector: Selection<any, any, any, any>,\n\t\toptions: getSVGElementSizeOptions = {\n\t\t\tuseAttrs: false,\n\t\t\tuseClientDimensions: false,\n\t\t\tuseBBox: false,\n\t\t\tuseBoundingRect: false,\n\t\t}\n\t) {\n\t\tif (!svgSelector.attr) {\n\t\t\tsvgSelector = select(svgSelector as any);\n\t\t}\n\n\t\tconst finalDimensions = {\n\t\t\twidth: 0,\n\t\t\theight: 0,\n\t\t};\n\n\t\tconst validateAndSetDimensions = (dimensions) => {\n\t\t\tif (dimensions) {\n\t\t\t\tObject.keys(finalDimensions).forEach((dimensionKey) => {\n\t\t\t\t\tif (dimensions[dimensionKey]) {\n\t\t\t\t\t\tconst dimension = dimensions[dimensionKey];\n\t\t\t\t\t\tconst dimensionNumber = parseFloat(dimension);\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tdimension &&\n\t\t\t\t\t\t\tdimensionNumber > finalDimensions[dimensionKey] &&\n\t\t\t\t\t\t\t('' + dimension).indexOf('%') === -1\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tfinalDimensions[dimensionKey] = dimensionNumber;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t};\n\n\t\tconst attrDimensions = {\n\t\t\twidth: svgSelector.attr('width'),\n\t\t\theight: svgSelector.attr('height'),\n\t\t};\n\n\t\tlet bbox, bboxDimensions, boundingRect, boundingRectDimensions;\n\t\t// In many versions of Firefox\n\t\t// getBBox will cause an \"NSFailure\" error\n\t\ttry {\n\t\t\tbbox = svgSelector.node().getBBox();\n\t\t\tbboxDimensions = {\n\t\t\t\twidth: bbox.width,\n\t\t\t\theight: bbox.height,\n\t\t\t};\n\t\t} catch (e) {}\n\n\t\ttry {\n\t\t\tboundingRect = svgSelector.node().getBoundingClientRect();\n\t\t\tboundingRectDimensions = {\n\t\t\t\twidth: boundingRect.width,\n\t\t\t\theight: boundingRect.height,\n\t\t\t};\n\t\t} catch (e) {}\n\n\t\tconst clientDimensions = {\n\t\t\twidth: svgSelector.node().clientWidth,\n\t\t\theight: svgSelector.node().clientHeight,\n\t\t};\n\n\t\t// If both attribute values are numbers\n\t\t// And not percentages or NaN\n\t\tif (options) {\n\t\t\tif (options.useAttrs) {\n\t\t\t\tvalidateAndSetDimensions(attrDimensions);\n\n\t\t\t\tif (finalDimensions.width > 0 && finalDimensions.height > 0) {\n\t\t\t\t\treturn finalDimensions;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (options.useClientDimensions) {\n\t\t\t\tvalidateAndSetDimensions(clientDimensions);\n\n\t\t\t\tif (finalDimensions.width > 0 && finalDimensions.height > 0) {\n\t\t\t\t\treturn clientDimensions;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (options.useBBox) {\n\t\t\t\tvalidateAndSetDimensions(bboxDimensions);\n\n\t\t\t\tif (finalDimensions.width > 0 && finalDimensions.height > 0) {\n\t\t\t\t\treturn bboxDimensions;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (options.useBoundingRect) {\n\t\t\t\tvalidateAndSetDimensions(boundingRectDimensions);\n\n\t\t\t\tif (finalDimensions.width > 0 && finalDimensions.height > 0) {\n\t\t\t\t\treturn boundingRectDimensions;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\ttry {\n\t\t\tconst nativeDimensions = {\n\t\t\t\twidth: Tools.getProperty(\n\t\t\t\t\tsvgSelector.node(),\n\t\t\t\t\t'width',\n\t\t\t\t\t'baseVal',\n\t\t\t\t\t'value'\n\t\t\t\t),\n\t\t\t\theight: Tools.getProperty(\n\t\t\t\t\tsvgSelector.node(),\n\t\t\t\t\t'height',\n\t\t\t\t\t'baseVal',\n\t\t\t\t\t'value'\n\t\t\t\t),\n\t\t\t};\n\n\t\t\tvalidateAndSetDimensions(nativeDimensions);\n\t\t} catch (e) {\n\t\t\tvalidateAndSetDimensions(clientDimensions);\n\t\t\tvalidateAndSetDimensions(bboxDimensions);\n\t\t\tvalidateAndSetDimensions(attrDimensions);\n\t\t}\n\n\t\treturn finalDimensions;\n\t}\n\n\tstatic appendOrSelect(parent, query) {\n\t\tconst selection = parent.select(`${query}`);\n\n\t\tif (selection.empty()) {\n\t\t\t// see if there is an id\n\t\t\tlet querySections = query.split('#');\n\t\t\tlet elementToAppend;\n\t\t\tlet id;\n\t\t\t// if there is an id\n\t\t\tif (querySections.length === 2) {\n\t\t\t\t// take out the element to append\n\t\t\t\telementToAppend = querySections[0];\n\t\t\t\t// split it by classes\n\t\t\t\tquerySections = querySections[1].split('.');\n\t\t\t\t// the first string is the id\n\t\t\t\tid = querySections[0];\n\t\t\t} else {\n\t\t\t\tquerySections = query.split('.');\n\t\t\t\telementToAppend = querySections[0];\n\t\t\t}\n\n\t\t\treturn parent\n\t\t\t\t.append(elementToAppend)\n\t\t\t\t.attr('id', id)\n\t\t\t\t.attr('class', querySections.slice(1).join(' '));\n\t\t}\n\n\t\treturn selection;\n\t}\n\n\tprotected mainContainer: HTMLElement;\n\tprotected width: string;\n\tprotected height: string;\n\n\tinit() {\n\t\t// Add width & height to the chart holder if necessary, and add a classname\n\t\tthis.styleHolderElement();\n\n\t\t// Initialize chart ID\n\t\tthis.initializeID();\n\n\t\tthis.addMainContainer();\n\t\tthis.verifyCSSStylesBeingApplied();\n\n\t\tif (this.model.getOptions().resizable) {\n\t\t\tthis.addResizeListener();\n\t\t}\n\n\t\tthis.addHolderListeners();\n\n\t\tthis.handleFullscreenChange();\n\t}\n\n\tgetChartID() {\n\t\treturn this.chartID;\n\t}\n\n\tgenerateElementIDString(originalID) {\n\t\treturn `chart-${this.chartID}-${originalID}`;\n\t}\n\n\tprivate initializeID() {\n\t\tthis.chartID = Math.floor(\n\t\t\t(1 + Math.random()) * 0x1000000000000\n\t\t).toString(16);\n\t}\n\n\taddMainContainer() {\n\t\tconst options = this.model.getOptions();\n\t\tconst chartsprefix = Tools.getProperty(options, 'style', 'prefix');\n\n\t\tconst mainContainer = select(this.getHolder())\n\t\t\t.append('div')\n\t\t\t.classed(`${carbonPrefix}--${chartsprefix}--chart-wrapper`, true)\n\t\t\t.attr('id', `chart-${this.getChartID()}`)\n\t\t\t.style('height', '100%')\n\t\t\t.style('width', '100%');\n\n\t\tmainContainer.append('g').attr('class', CSS_VERIFIER_ELEMENT_CLASSNAME);\n\n\t\tthis.mainContainer = mainContainer.node();\n\t}\n\n\tupdate() {\n\t\tthis.styleHolderElement();\n\t}\n\n\tstyleHolderElement() {\n\t\tconst holderElement = this.getHolder() as HTMLElement;\n\n\t\t// In order for resize events to not clash with these updates\n\t\t// We'll check if the width & height values passed in options\n\t\t// Have changed, before setting them to the holder\n\t\tconst { width, height, theme } = this.model.getOptions();\n\t\tif (width !== this.width) {\n\t\t\t// Apply formatted width attribute to chart\n\t\t\tholderElement.style.width = width;\n\n\t\t\tthis.width = width;\n\t\t}\n\n\t\tif (height !== this.height) {\n\t\t\t// Apply formatted width attribute to chart\n\t\t\tholderElement.style.height = height;\n\n\t\t\tthis.height = height;\n\t\t}\n\n\t\t// Add class to chart holder\n\t\tselect(this.getHolder())\n\t\t\t.classed(`${carbonPrefix}--chart-holder`, true)\n\t\t\t.attr('data-carbon-theme', theme);\n\t}\n\n\tgetHolder() {\n\t\treturn this.model.get('holder');\n\t}\n\n\texportToJPG() {\n\t\tconst self = this;\n\t\tconst options = this.model.getOptions();\n\n\t\tconst holder = this.getHolder();\n\t\tconst holderSelection = select(holder);\n\t\tholderSelection.classed('filled', true);\n\n\t\tdomToImage\n\t\t\t.toJpeg(this.getMainContainer(), {\n\t\t\t\tbgcolor:\n\t\t\t\t\ttypeof window !== 'undefined'\n\t\t\t\t\t\t? window\n\t\t\t\t\t\t\t\t.getComputedStyle(holder)\n\t\t\t\t\t\t\t\t.getPropertyValue('background-color')\n\t\t\t\t\t\t: undefined,\n\t\t\t\tquality: 1,\n\t\t\t\t// Remove the toolbar\n\t\t\t\tfilter: (node) => {\n\t\t\t\t\tif (\n\t\t\t\t\t\tnode.classList &&\n\t\t\t\t\t\tnode.classList.contains('cds--cc--toolbar')\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn true;\n\t\t\t\t},\n\t\t\t})\n\t\t\t.then(function (dataUrl) {\n\t\t\t\tlet fileName = 'myChart';\n\t\t\t\tconst customFilename = Tools.getProperty(\n\t\t\t\t\toptions,\n\t\t\t\t\t'fileDownload',\n\t\t\t\t\t'fileName'\n\t\t\t\t);\n\n\t\t\t\tif (typeof customFilename === 'function') {\n\t\t\t\t\tfileName = customFilename('jpg');\n\t\t\t\t}\n\n\t\t\t\tself.services.files.downloadImage(dataUrl, `${fileName}.jpg`);\n\t\t\t\tholderSelection.classed('filled', false);\n\t\t\t});\n\t}\n\n\texportToPNG() {\n\t\tconst self = this;\n\t\tconst options = this.model.getOptions();\n\n\t\tconst holder = this.getHolder();\n\t\tconst holderSelection = select(holder);\n\t\tholderSelection.classed('filled', true);\n\n\t\tdomToImage\n\t\t\t.toPng(this.getMainContainer(), {\n\t\t\t\tbgcolor:\n\t\t\t\t\ttypeof window !== 'undefined'\n\t\t\t\t\t\t? window\n\t\t\t\t\t\t\t\t.getComputedStyle(holder)\n\t\t\t\t\t\t\t\t.getPropertyValue('background-color')\n\t\t\t\t\t\t: undefined,\n\t\t\t\tquality: 1,\n\t\t\t\t// Remove the toolbar\n\t\t\t\tfilter: (node) => {\n\t\t\t\t\tif (\n\t\t\t\t\t\tnode.classList &&\n\t\t\t\t\t\tnode.classList.contains('cds--cc--toolbar')\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn true;\n\t\t\t\t},\n\t\t\t})\n\t\t\t.then(function (dataUrl) {\n\t\t\t\tlet fileName = 'myChart';\n\t\t\t\tconst customFilename = Tools.getProperty(\n\t\t\t\t\toptions,\n\t\t\t\t\t'fileDownload',\n\t\t\t\t\t'fileName'\n\t\t\t\t);\n\n\t\t\t\tif (typeof customFilename === 'function') {\n\t\t\t\t\tfileName = customFilename('png');\n\t\t\t\t}\n\n\t\t\t\tself.services.files.downloadImage(dataUrl, `${fileName}.png`);\n\t\t\t\tholderSelection.classed('filled', false);\n\t\t\t})\n\t\t\t.catch(function (error) {\n\t\t\t\tconsole.error('oops, something went wrong!', error);\n\t\t\t});\n\t}\n\n\ttoggleFullscreen() {\n\t\tconst holder = this.getHolder();\n\t\tconst holderSelection = select(holder);\n\n\t\tconst isFullScreen = holderSelection.classed('fullscreen');\n\n\t\tif (\n\t\t\tisFullScreen &&\n\t\t\t(document.fullscreenElement ||\n\t\t\t\tdocument['webkitFullscreenElement'] ||\n\t\t\t\tdocument['mozFullScreenElement'] ||\n\t\t\t\tdocument['msFullscreenElement'])\n\t\t) {\n\t\t\t// Call the correct function depending on the browser\n\t\t\tif (document.exitFullscreen) {\n\t\t\t\tdocument.exitFullscreen();\n\t\t\t} else if (document['webkitExitFullscreen']) {\n\t\t\t\tdocument['webkitExitFullscreen']();\n\t\t\t} else if (document['mozCancelFullScreen']) {\n\t\t\t\tdocument['mozCancelFullScreen']();\n\t\t\t} else if (document['msExitFullscreen']) {\n\t\t\t\tdocument['msExitFullscreen']();\n\t\t\t}\n\t\t} else {\n\t\t\t// Call the correct function depending on the browser\n\t\t\tif (holder.requestFullscreen) {\n\t\t\t\tholder.requestFullscreen();\n\t\t\t} else if (holder.webkitRequestFullscreen) {\n\t\t\t\tholder.webkitRequestFullscreen();\n\t\t\t} else if (holder.mozRequestFullScreen) {\n\t\t\t\tholder.mozRequestFullScreen();\n\t\t\t} else if (holder.msRequestFullscreen) {\n\t\t\t\tholder.msRequestFullscreen();\n\t\t\t}\n\t\t}\n\t}\n\n\thandleFullscreenChange() {\n\t\tdocument.addEventListener('fullscreenchange', () => {\n\t\t\tconst holderSelection = select(this.getHolder());\n\t\t\tconst isFullScreen = holderSelection.classed('fullscreen');\n\n\t\t\t// Toggle the `fullscreen` classname\n\t\t\tholderSelection.classed('fullscreen', !isFullScreen);\n\t\t});\n\t}\n\n\tverifyCSSStylesBeingApplied() {\n\t\t// setTimeout is needed here since in `addSVGElement()` we're appending the\n\t\t// CSS verifier element, and need to allow some time for it to become available\n\t\t// in the DOM\n\t\tsetTimeout(() => {\n\t\t\tconst cssVerifierElement = select(this.mainContainer)\n\t\t\t\t.select(`g.${CSS_VERIFIER_ELEMENT_CLASSNAME}`)\n\t\t\t\t.node();\n\t\t\tconst computedStyles = getComputedStyle(cssVerifierElement as any);\n\t\t\tif (\n\t\t\t\tcomputedStyles.getPropertyValue('overflow') !== 'hidden' ||\n\t\t\t\tcomputedStyles.getPropertyValue('opacity') !== '0'\n\t\t\t) {\n\t\t\t\tconsole.error(\n\t\t\t\t\t'Missing CSS styles for Carbon Charts. Please read the Carbon Charts getting started guide.'\n\t\t\t\t);\n\t\t\t}\n\t\t});\n\t}\n\n\tsetSVGMaxHeight() {\n\t\t// if there is a set height on the holder, leave the chart svg height at 100%\n\t\tif (!this.model.getOptions().height) {\n\t\t\tconst { height: chartHeight } = DOMUtils.getSVGElementSize(\n\t\t\t\tselect(this.mainContainer),\n\t\t\t\t{ useBBox: true }\n\t\t\t);\n\t\t\tconst chartSVGSelector = select(this.mainContainer).attr('class');\n\t\t\tconst children = select(this.mainContainer).selectAll(\n\t\t\t\t`.${chartSVGSelector} > svg`\n\t\t\t);\n\n\t\t\t// get the height of the children SVGs (spacers, titles, etc)\n\t\t\tlet childrenHeight = 0;\n\t\t\tchildren.nodes().forEach(function (childSVG) {\n\t\t\t\tchildrenHeight += Number(\n\t\t\t\t\tDOMUtils.getSVGElementSize(select(childSVG), {\n\t\t\t\t\t\tuseBBox: true,\n\t\t\t\t\t}).height\n\t\t\t\t);\n\t\t\t});\n\n\t\t\t// set the chart svg height to the children height\n\t\t\t// forcing the chart not to take up any more space than it requires\n\t\t\tchildrenHeight <= chartHeight\n\t\t\t\t? select(this.mainContainer).attr('height', childrenHeight)\n\t\t\t\t: select(this.mainContainer).attr('height', '100%');\n\t\t}\n\t}\n\n\tgetMainContainer() {\n\t\treturn this.mainContainer;\n\t}\n\n\taddHolderListeners() {\n\t\tconst holder = this.getHolder();\n\n\t\tif (!holder) {\n\t\t\treturn;\n\t\t}\n\n\t\tselect(holder)\n\t\t\t.on('mouseover', () => {\n\t\t\t\t// Dispatch event\n\t\t\t\tthis.services.events.dispatchEvent(Events.Chart.MOUSEOVER);\n\t\t\t})\n\t\t\t.on('mouseout', () => {\n\t\t\t\t// Dispatch event\n\t\t\t\tthis.services.events.dispatchEvent(Events.Chart.MOUSEOUT);\n\t\t\t});\n\t}\n\n\taddResizeListener() {\n\t\tconst holder = this.getHolder();\n\n\t\tif (!holder) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Grab current dimensions of the chart holder\n\t\tlet containerWidth = holder.clientWidth;\n\t\tlet containerHeight = holder.clientHeight;\n\n\t\t// The resize callback function\n\t\tconst resizeCallback = Tools.debounce((entries, observer) => {\n\t\t\tif (!holder) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tMath.abs(containerWidth - holder.clientWidth) > 1 ||\n\t\t\t\tMath.abs(containerHeight - holder.clientHeight) > 1\n\t\t\t) {\n\t\t\t\tcontainerWidth = holder.clientWidth;\n\t\t\t\tcontainerHeight = holder.clientHeight;\n\n\t\t\t\tthis.services.events.dispatchEvent(Events.Chart.RESIZE);\n\t\t\t}\n\t\t}, 12.5);\n\n\t\t// Observe the behaviour of resizing on the holder\n\t\tconst resizeObserver = new ResizeObserver(resizeCallback);\n\t\tresizeObserver.observe(holder);\n\t}\n}\n"]}
|