@kiwibit/chart 20.0.0 → 21.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/kiwibit-chart.mjs +591 -0
- package/fesm2022/kiwibit-chart.mjs.map +1 -0
- package/package.json +27 -15
- package/{src/lib/models/chart.models.ts → types/kiwibit-chart.d.ts} +229 -183
- package/CHANGELOG.md +0 -164
- package/karma.conf.js +0 -44
- package/ng-package.json +0 -10
- package/src/lib/components/chart.component.ts +0 -76
- package/src/lib/constants/chart.constants.ts +0 -5
- package/src/lib/directives/kiwi-chart.directive.ts +0 -488
- package/src/public-api.ts +0 -6
- package/src/test.ts +0 -15
- package/tsconfig.lib.json +0 -15
- package/tsconfig.lib.prod.json +0 -10
- package/tsconfig.spec.json +0 -17
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kiwibit-chart.mjs","sources":["../../../../projects/kiwibit/chart/src/lib/models/chart.models.ts","../../../../projects/kiwibit/chart/src/lib/constants/chart.constants.ts","../../../../projects/kiwibit/chart/src/lib/directives/kiwi-chart.directive.ts","../../../../projects/kiwibit/chart/src/lib/components/chart.component.ts","../../../../projects/kiwibit/chart/src/public-api.ts","../../../../projects/kiwibit/chart/src/kiwibit-chart.ts"],"sourcesContent":["/**\r\n * Interface to define the Chart model.\r\n *\r\n * @export\r\n * @interface Chart\r\n */\r\nexport interface Chart {\r\n title: string;\r\n showLegend?: boolean;\r\n xAxisType: AxisType;\r\n xAxisName: string;\r\n xAxisUom?: string;\r\n xMin?: number;\r\n xMax?: number;\r\n yAxisType: AxisType;\r\n yAxisName: string;\r\n yAxisUom?: string;\r\n yMin?: number;\r\n yMax?: number;\r\n /**\r\n * The maximum decimals that can have the values on the x and y axes.\r\n * If omitted the default is 3 decimals.\r\n *\r\n * @type {number}\r\n * @memberof Chart\r\n */\r\n maxAxesDecimals?: number;\r\n /**\r\n * If the chart should have rendering animations.\r\n *\r\n * @type {boolean}\r\n * @memberof Chart\r\n */\r\n hasAnimations?: boolean;\r\n /**\r\n * How long the animation should last.\r\n * Expressed in milliseconds. If omitted the Default is 500 ms.\r\n *\r\n * @type {number}\r\n * @memberof Chart\r\n */\r\n animationDuration?: number;\r\n /**\r\n * The list of Shapes that the chart must render.\r\n * Each Shape corrisponds to a single chart component.\r\n *\r\n * @type {Shape[]}\r\n * @memberof Chart\r\n */\r\n shapes: Shape[];\r\n /**\r\n * Adds interaction with the chart, so that when clicking\r\n * everywhere in the chart area a point gets added and it's coordinate are \r\n * emitted with an event to the parent component.\r\n *\r\n * @type {boolean}\r\n * @memberof Chart\r\n */\r\n clickToAddPoint?: boolean;\r\n /**\r\n * Custom name for the \"clickToAddPoint\" event related button. \r\n *\r\n * @type {string}\r\n * @memberof Chart\r\n */\r\n addPointCustomName?: string;\r\n /**\r\n * Adds the possibility to use the scroll \r\n * to zoom in/out the chart area.\r\n *\r\n * @type {boolean}\r\n * @memberof Chart\r\n */\r\n scrollToZoom?: boolean;\r\n /**\r\n * Tells the chart to render or not the grid lines.\r\n *\r\n * @type {boolean}\r\n * @memberof Chart\r\n */\r\n showGrid?: boolean;\r\n}\r\n\r\nexport type Shape = Trace;\r\n\r\nexport interface Trace {\r\n name?: string;\r\n /**\r\n * The variant of the Shape, must be of type Trace.\r\n *\r\n * @type {ShapeVariant}\r\n * @memberof Trace\r\n */\r\n variant: ShapeVariant;\r\n color?: string;\r\n /**\r\n * The type of the Trace drawn by the chart.\r\n * Can be a line or a scatter. \r\n *\r\n * @type {TraceType}\r\n * @memberof Trace\r\n */\r\n type: TraceType;\r\n width?: number;\r\n /**\r\n * The list of points that define the Trace.\r\n *\r\n * @type {Point[]}\r\n * @memberof Trace\r\n */\r\n points: Point[];\r\n /**\r\n * Whether to show a smooth curve or a segmented curve.\r\n *\r\n * @type {boolean}\r\n * @memberof Trace\r\n */\r\n smooth?: boolean;\r\n /**\r\n * The style of the Trace.\r\n * Can be solid, dashed or dotted.\r\n *\r\n * @type {TraceStyle}\r\n * @memberof Trace\r\n */\r\n style?: TraceStyle;\r\n /**\r\n * Option to make the Trace selected/deselected by default.\r\n * A deselected Trace is obscured from the chart and can be toggled from the legend. \r\n *\r\n * @type {boolean}\r\n * @memberof Trace\r\n */\r\n selectedByDefault?: boolean;\r\n opacity?: number;\r\n}\r\n\r\nexport interface Point extends BasePoint {\r\n name?: string;\r\n /**\r\n * Symbol used to represent the point in the chart.\r\n *\r\n * @type {PointSymbol}\r\n * @memberof Point\r\n */\r\n symbol?: PointSymbol;\r\n symbolSize?: number;\r\n color?: string;\r\n}\r\n\r\nexport interface BasePoint {\r\n x: number;\r\n y: number\r\n}\r\n\r\nexport enum TraceType {\r\n LINE = \"line\",\r\n SCATTER = \"scatter\"\r\n}\r\n\r\nexport enum PointSymbol {\r\n NONE = \"none\",\r\n CIRCLE = \"circle\",\r\n TRIANGLE = \"triangle\",\r\n PIN = \"pin\",\r\n DIAMOND = \"diamond\"\r\n}\r\n\r\nexport enum TraceStyle {\r\n SOLID = \"solid\",\r\n DASHED = \"dashed\",\r\n DOTTED = \"dotted\"\r\n}\r\n\r\nexport enum AxisType {\r\n VALUE = \"value\"\r\n}\r\n\r\nexport enum ShapeVariant {\r\n TRACE\r\n}\r\n\r\nexport type ChartTheme = 'default' | 'dark';","export const ZOOM_IN: string = \"M39.35 40.45 26.6 27.7q-1.55 1.35-3.6 2.025-2.05.675-4 .675-4.9 0-8.225-3.325Q7.45 23.75 7.45 18.9q0-4.9 3.325-8.225Q14.1 7.35 18.95 7.35q4.85 0 8.225 3.325t3.375 8.175q0 2.1-.725 4.1-.725 2-2.025 3.45l12.8 12.75ZM19 28.65q4.15 0 6.975-2.8 2.825-2.8 2.825-7 0-4.15-2.825-6.95T19 9.1q-4.2 0-7 2.8t-2.8 6.95q0 4.2 2.8 7t7 2.8Zm-.9-5.1V19.7h-3.85v-1.75h3.85v-3.8h1.75v3.8h3.8v1.75h-3.8v3.85Z\";\r\nexport const ZOOM_OUT: string = \"M41.25 39.35 29.55 27.7q-1.5 1.25-3.525 1.975Q24 30.4 22.05 30.4q-2.1 0-3.975-.725T14.9 27.65l1.2-1.2q1.2 1.1 2.65 1.65 1.45.55 3.25.55 4.2 0 7-2.8t2.8-7q0-4.15-2.8-6.95t-7-2.8q-4.15 0-7 2.8-2.85 2.8-2.75 6.95l3.2-3.4 1.3 1.3-5.35 5.35-5.3-5.35 1.3-1.3 3.05 3.3q0-4.85 3.4-8.125Q17.25 7.35 22 7.35q4.9 0 8.225 3.325Q33.55 14 33.55 18.85q0 2.1-.75 4.1-.75 2-1.95 3.45L42.5 38.05Z\";\r\nexport const SAVE_AS_SVG: string = \"M11.3 40.05q-1.35 0-2.35-1t-1-2.35V11.3q0-1.4 1-2.375 1-.975 2.35-.975h25.4q1.4 0 2.375.975.975.975.975 2.375v25.4q0 1.35-.975 2.35t-2.375 1Zm0-1.75h25.4q.6 0 1.1-.5.5-.5.5-1.1V11.3q0-.6-.5-1.1-.5-.5-1.1-.5H11.3q-.6 0-1.1.5-.5.5-.5 1.1v25.4q0 .6.5 1.1.5.5 1.1.5Zm4.1-5.15h17.65l-5.5-7.3-5.2 6.45-3.3-3.85ZM9.7 38.3V9.7v28.6Z\";\r\nexport const RESTORE: string = \"M24.2 25.65q-.65 0-1.125-.475T22.6 24q0-.7.475-1.2t1.175-.5q.65 0 1.175.525T25.95 24q0 .7-.55 1.175-.55.475-1.2.475Zm.1 14.55q-6.4 0-11.1-4.25Q8.5 31.7 8.1 25.4h1.8q.5 5.55 4.6 9.3 4.1 3.75 9.75 3.75 6.05 0 10.225-4.225T38.65 24.05q0-6.05-4.2-10.275Q30.25 9.55 24.3 9.55q-3.2 0-6.025 1.3t-4.875 3.6h4.95v1.75H10.4v-8h1.75v5.05q2.25-2.6 5.475-4.025Q20.85 7.8 24.3 7.8q3.3 0 6.225 1.25t5.125 3.475q2.2 2.225 3.475 5.175Q40.4 20.65 40.4 24q0 3.35-1.275 6.3-1.275 2.95-3.475 5.175-2.2 2.225-5.125 3.475T24.3 40.2Z\";\r\nexport const ADD_POINT: string = \"M222.895-189.538q-22.456 0-37.906-15.451-15.451-15.45-15.451-37.906v-474.21q0-22.456 15.451-37.906 15.45-15.451 38.088-15.451h322.346v28.924H223.077q-10.769 0-17.692 6.923t-6.923 17.692v473.846q0 10.769 6.923 17.692t17.692 6.923h473.846q10.77 0 17.693-6.923 6.923-6.923 6.923-17.692v-322.346h28.923v322.346q0 22.638-15.451 38.088-15.45 15.451-37.906 15.451h-474.21Zm78.028-121.539h28.923v-243.077h-28.923v243.077Zm144.923 0h28.923v-337.846h-28.923v337.846Zm144.308 0h28.923v-148.308h-28.923v148.308Zm100-327.692v-71.385h-71.385v-28.923h71.385v-71.385h28.923v71.385h71.385v28.923h-71.385v71.385h-28.923ZM460-480Z\";\r\nexport const highlightColor: string = '#98BD13';","// Angular Imports\r\nimport { AfterViewInit, Directive, ElementRef, EventEmitter, HostListener, Input, OnChanges, Output, SimpleChanges } from '@angular/core';\r\n// Kiwi Chart Imports\r\nimport { BasePoint, Chart, Point, Shape, ShapeVariant, Trace } from '../models/chart.models';\r\nimport { ADD_POINT, highlightColor, RESTORE, SAVE_AS_SVG, ZOOM_IN, ZOOM_OUT } from '../constants/chart.constants';\r\n// Echarts Imports\r\nimport * as echarts from 'echarts/core';\r\nimport {\r\n ComposeOption,\r\n CustomSeriesOption,\r\n LegendComponentOption,\r\n LineSeriesOption,\r\n ScatterSeriesOption,\r\n ToolboxComponentOption\r\n} from 'echarts/types/dist/shared';\r\nimport { TitleComponent, TooltipComponent, GridComponent, LegendComponent, DataZoomComponent, ToolboxComponent, TitleComponentOption, TooltipComponentOption, GridComponentOption, DatasetComponentOption } from 'echarts/components';\r\nimport { LineChart, ScatterChart } from 'echarts/charts';\r\nimport { CanvasRenderer } from 'echarts/renderers';\r\necharts.use([\r\n TitleComponent,\r\n TooltipComponent,\r\n GridComponent,\r\n LineChart,\r\n ScatterChart,\r\n CanvasRenderer,\r\n LegendComponent,\r\n DataZoomComponent,\r\n ToolboxComponent,\r\n]);\r\nexport type ECOption = ComposeOption<\r\n | LineSeriesOption\r\n | TitleComponentOption\r\n | TooltipComponentOption\r\n | GridComponentOption\r\n | DatasetComponentOption\r\n | LegendComponentOption\r\n | ToolboxComponentOption\r\n>;\r\n\r\n@Directive({\r\n selector: 'div[kiwi-chart]',\r\n standalone: true\r\n})\r\nexport class KiwiChartDirective implements OnChanges, AfterViewInit {\r\n\r\n /**\r\n * The Chart Object rendered by the canvas. For all the available options refer \r\n * to Chart interface in the models folder.\r\n *\r\n * @type {(Chart | null)}\r\n * @memberof KiwiChartDirective\r\n */\r\n @Input({ required: true }) chart: Chart | null = null;\r\n\r\n /**\r\n * Width and Height of the chart area. The dimensions refer to the father component \r\n * into which the kiwi-chart is inserted. For example in an empty page the width/height \r\n * of the chart can take the whole available space in the page.\r\n *\r\n * @type {string}\r\n * @memberof KiwiChartDirective\r\n */\r\n @Input() width: string = '100%';\r\n @Input() height: string = '480px';\r\n\r\n @Output() chartInit = new EventEmitter<echarts.ECharts>();\r\n\r\n /**\r\n * Output event used to emit to the father component the coordinates\r\n * of the point clicked in the chart area. This functionality to be used must\r\n * have the property \"clickToAddPoint\" in the Chart object set to true.\r\n *\r\n * @type {EventEmitter<BasePoint>}\r\n * @memberof KiwiChartDirective\r\n */\r\n @Output() addPoint: EventEmitter<BasePoint> = new EventEmitter<BasePoint>();\r\n\r\n /**\r\n * When the cursor hovers the chart area it emits to the father component the\r\n * x and y coordinates relative to the chart reference system.\r\n *\r\n * @type {EventEmitter<BasePoint>}\r\n * @memberof KiwiChartDirective\r\n */\r\n @Output() chartHover: EventEmitter<BasePoint> = new EventEmitter<BasePoint>();\r\n\r\n /**\r\n * This property simply activates or not the dark theme of the chart\r\n * defined by the Echarts library. In addition the background color can be custom\r\n * so that the chart can match the background of the application in which it's used.\r\n *\r\n * @type {boolean}\r\n * @memberof KiwiChartDirective\r\n */\r\n @Input() darkTheme: boolean = false;\r\n @Input() darkThemeBackground: string | null = null;\r\n\r\n /**\r\n * The instance of the Chart.\r\n *\r\n * @type {ECharts}\r\n * @memberof KiwiChartDirective\r\n */\r\n echartsInstance: echarts.ECharts | null = null;\r\n\r\n /**\r\n * Default number of decimals that can have\r\n * the values on the x and y axes.\r\n *\r\n * @private\r\n * @type {number}\r\n * @memberof KiwiChartDirective\r\n */\r\n private readonly MAX_DECIMALS: number = 3;\r\n\r\n private legendSelected: { [key: string]: boolean } = {};\r\n private isLegendClicked: boolean = false;\r\n\r\n /**\r\n * Used to perform actions (as point addition based on the cursor position) on the chart.\r\n *\r\n * @type {(zrender.ZRenderType | null)}\r\n * @memberof KiwiChartComponent\r\n */\r\n zr: echarts.zrender.ZRenderType | null = null;\r\n\r\n /**\r\n * If you resize the page, the chart is automatically re-rendered wiht the right proportions.\r\n *\r\n * @memberof EnchartingDirective\r\n */\r\n @HostListener('window:resize')\r\n onResize() {\r\n if (this.echartsInstance) {\r\n this.echartsInstance.resize();\r\n }\r\n }\r\n\r\n constructor(\r\n private el: ElementRef<HTMLDivElement>\r\n ) { }\r\n\r\n ngAfterViewInit(): void {\r\n if (this.chart) {\r\n this.renderChart(this.chart);\r\n }\r\n }\r\n\r\n ngOnChanges(changes: SimpleChanges): void {\r\n let chart: Chart = changes['chart']?.currentValue;\r\n if (this.echartsInstance) {\r\n // Every time we have an external change we\r\n // destroy the chart and re-initialize it\r\n this.echartsInstance.dispose();\r\n this.renderChart(chart);\r\n }\r\n }\r\n\r\n renderChart(chart: Chart): void {\r\n // Update ElementRef styles\r\n this.el.nativeElement.style.width = this.width;\r\n this.el.nativeElement.style.height = this.height;\r\n\r\n this.echartsInstance = echarts.init(\r\n this.el.nativeElement,\r\n this.darkTheme ? 'dark' : 'default',\r\n {\r\n renderer: 'svg'\r\n }\r\n );\r\n\r\n if (chart) {\r\n this.echartsInstance.setOption({\r\n title: {\r\n text: chart.title,\r\n left: 0\r\n },\r\n grid: {\r\n id: 0,\r\n width: '70%'\r\n },\r\n backgroundColor: this.darkTheme ? this.darkThemeBackground ?? '#303030' : 'transparent', tooltip: {\r\n axisPointer: {\r\n type: 'cross',\r\n crossStyle: {\r\n color: '#bebebe'\r\n }\r\n }\r\n },\r\n toolbox: {\r\n orient: 'horizontal',\r\n left: 'center',\r\n top: '25px',\r\n feature: {\r\n dataZoom: {\r\n brushStyle: {\r\n borderColor: '#000',\r\n borderWidth: 1,\r\n borderType: 'dashed'\r\n },\r\n emphasis: {\r\n iconStyle: {\r\n textPosition: 'top',\r\n textPadding: 5,\r\n borderColor: highlightColor\r\n }\r\n },\r\n icon: {\r\n zoom: ZOOM_IN,\r\n back: ZOOM_OUT\r\n },\r\n },\r\n saveAsImage: {\r\n emphasis: {\r\n iconStyle: {\r\n textPosition: 'top',\r\n textPadding: 5\r\n }\r\n },\r\n icon: SAVE_AS_SVG,\r\n },\r\n restore: {\r\n emphasis: {\r\n iconStyle: {\r\n textPosition: 'top',\r\n textPadding: 5\r\n }\r\n },\r\n icon: RESTORE,\r\n },\r\n myAddPoint: {\r\n show: chart.clickToAddPoint ?? false,\r\n title: chart.addPointCustomName ?? 'Add Point',\r\n icon: ADD_POINT,\r\n onclick: () => {\r\n if (this.echartsInstance) {\r\n const option: ECOption = this.echartsInstance.getOption();\r\n const toolbox = option.toolbox as ToolboxComponentOption[];\r\n if (toolbox) {\r\n const status: boolean = toolbox[0].feature?.['myAddPoint']?.iconStatus;\r\n const offColor: string = '#6578BA';\r\n this.echartsInstance.setOption({\r\n toolbox: {\r\n feature: {\r\n myAddPoint: {\r\n iconStatus: !status,\r\n iconStyle: {\r\n borderColor: !status ? highlightColor : offColor\r\n }\r\n }\r\n }\r\n }\r\n });\r\n }\r\n }\r\n },\r\n emphasis: {\r\n iconStyle: {\r\n textPosition: 'top',\r\n textPadding: 5,\r\n borderColor: highlightColor\r\n }\r\n }\r\n }\r\n },\r\n },\r\n dataZoom: [\r\n {\r\n type: 'inside',\r\n xAxisIndex: [0],\r\n throttle: 0,\r\n filterMode: 'none',\r\n disabled: !chart.scrollToZoom\r\n },\r\n {\r\n type: 'inside',\r\n yAxisIndex: [0],\r\n throttle: 0,\r\n filterMode: 'none',\r\n disabled: !chart.scrollToZoom\r\n },\r\n ],\r\n legend: {\r\n inactiveColor: this.darkTheme ? '#8b8b8b' : '#ccc',\r\n data: chart.shapes.map(\r\n (shape: Shape) => ({\r\n name: shape.name,\r\n icon: 'circle',\r\n })\r\n ),\r\n selected: chart.shapes.reduce(\r\n (accumulator, shape: Shape) => ({\r\n ...accumulator,\r\n [shape.name as string]: this.getLegendItemSelection(shape),\r\n }),\r\n {}),\r\n show: chart.showLegend ?? false,\r\n orient: 'vertical',\r\n left: 'right',\r\n top: 0,\r\n padding: [60, 20],\r\n type: 'scroll',\r\n textStyle: {\r\n width: 120,\r\n fontWeight: 'bold',\r\n overflow: 'break'\r\n }\r\n },\r\n xAxis: {\r\n type: chart.xAxisType,\r\n name: chart.xAxisUom ? `${chart.xAxisName} [ ${chart.xAxisUom} ]` : chart.xAxisName,\r\n nameLocation: 'middle',\r\n nameGap: 30,\r\n splitLine: {\r\n show: chart.showGrid ?? true,\r\n lineStyle: {\r\n color: this.darkTheme ? '#595959' : '#ccc'\r\n }\r\n },\r\n min: chart.xMin?.toFixed(chart.maxAxesDecimals ?? this.MAX_DECIMALS),\r\n max: chart.xMax?.toFixed(chart.maxAxesDecimals ?? this.MAX_DECIMALS),\r\n },\r\n yAxis: {\r\n type: chart.yAxisType,\r\n name: chart.yAxisUom ? `${chart.yAxisName} [ ${chart.yAxisUom} ]` : chart.yAxisName,\r\n nameLocation: 'middle',\r\n nameGap: 50,\r\n splitLine: {\r\n show: chart.showGrid ?? true,\r\n lineStyle: {\r\n color: this.darkTheme ? '#595959' : '#ccc'\r\n }\r\n },\r\n min: chart.yMin?.toFixed(chart.maxAxesDecimals ?? this.MAX_DECIMALS),\r\n max: chart.yMax?.toFixed(chart.maxAxesDecimals ?? this.MAX_DECIMALS),\r\n },\r\n series: this.createSeries(chart.shapes),\r\n animation: chart.hasAnimations,\r\n animationDuration: chart.animationDuration ?? 250,\r\n animationEasing: 'cubicOut'\r\n },\r\n true,\r\n true\r\n );\r\n }\r\n\r\n this.setupZrEventHandler(this.echartsInstance);\r\n\r\n this.setupLegendEventHandler(this.echartsInstance);\r\n }\r\n\r\n createSeries(shapes: Shape[]): Array<LineSeriesOption | CustomSeriesOption | ScatterSeriesOption> {\r\n let series: Array<LineSeriesOption | CustomSeriesOption | ScatterSeriesOption> = [];\r\n shapes.forEach(\r\n (shape: Shape) => {\r\n switch (shape.variant) {\r\n case ShapeVariant.TRACE:\r\n series.push(this.createTrace(shape as Trace))\r\n break;\r\n default:\r\n break;\r\n }\r\n }\r\n );\r\n return series;\r\n }\r\n\r\n createTrace(trace: Trace): LineSeriesOption | ScatterSeriesOption {\r\n return {\r\n type: trace.type,\r\n name: trace.name,\r\n data: trace.points.map(\r\n (point: Point) => ({\r\n value: [point.x, point.y],\r\n symbol: point.symbol ?? 'circle',\r\n name: point.name,\r\n symbolSize: point.symbolSize ?? 2,\r\n itemStyle: {\r\n color: point.color\r\n },\r\n emphasis: {\r\n disabled: true\r\n },\r\n label: {\r\n show: true,\r\n position: 'bottom',\r\n align: 'left',\r\n verticalAlign: 'bottom',\r\n formatter: () => `${point.name ?? ''}`,\r\n fontSize: 13,\r\n padding: [0, 0, 0, 10],\r\n width: 100,\r\n overflow: 'truncate',\r\n ellipsis: '...',\r\n fontWeight: 'bold',\r\n color: this.darkTheme ? '#fff' : '#000'\r\n },\r\n tooltip: {\r\n formatter: ({ value }: { value: number[] }) => `\r\n <strong>${this.chart?.xAxisName}:</strong> ${value[0].toFixed(3).replace(/[.,]000$/, \"\")}\r\n <br>\r\n <strong>${this.chart?.yAxisName}:</strong> ${value[1].toFixed(3).replace(/[.,]000$/, \"\")}\r\n `\r\n }\r\n })\r\n ),\r\n color: trace.color,\r\n lineStyle: {\r\n width: trace.width,\r\n type: trace.style,\r\n opacity: trace.opacity ?? 1\r\n },\r\n smooth: trace.smooth ?? false\r\n };\r\n }\r\n\r\n getLegendItemSelection(shape: Shape): boolean {\r\n if (this.isLegendClicked) {\r\n return this.legendSelected[shape.name as string] ?? true;\r\n }\r\n else {\r\n return shape.selectedByDefault ?? true\r\n }\r\n }\r\n\r\n /**\r\n * intercept a selection change event on the legend and save the state \r\n * of all selections on the supporting variable legendSelected\r\n * \r\n * @param ec \r\n */\r\n setupLegendEventHandler(ec: echarts.ECharts) {\r\n if (this.echartsInstance != null) {\r\n this.echartsInstance.on('legendselectchanged', (params: any) => {\r\n this.isLegendClicked = true;\r\n this.legendSelected = params.selected;\r\n });\r\n }\r\n\r\n }\r\n\r\n setupZrEventHandler(ec: echarts.ECharts) {\r\n this.zr = ec.getZr();\r\n /** \r\n * Intercepts the click event on the chart (if the clickToAddPoint property is set to true)\r\n * and emits the point coordinates to the father component.\r\n */\r\n this.zr.on('click', params => {\r\n let option: any = ec.getOption();\r\n let active = option?.toolbox?.[0]?.feature?.myAddPoint?.iconStatus;\r\n if (active && this.chart?.clickToAddPoint) {\r\n const pointInPixel = [params.offsetX, params.offsetY];\r\n const pointInGrid = ec.convertFromPixel({ gridIndex: 0 }, pointInPixel);\r\n if (ec.containPixel({ gridIndex: 0 }, pointInPixel) && pointInGrid) {\r\n let newPoint: { x: number, y: number } = {\r\n x: +pointInGrid[0].toFixed(3),\r\n y: +pointInGrid[1].toFixed(3)\r\n };\r\n this.addPoint.emit(newPoint);\r\n }\r\n }\r\n });\r\n /** \r\n * This is used perform custom actions when the mouse is hovering the chart area\r\n */\r\n this.zr.on('mousemove', params => {\r\n const pointInPixel = [params.offsetX, params.offsetY];\r\n const pointInGrid = ec.convertFromPixel({ gridIndex: 0 }, pointInPixel);\r\n /*\r\n * Logic to emit to the father component the x and y coordinates when the\r\n * cursor is hovering the chart area.\r\n */\r\n if (ec.containPixel({ gridIndex: 0 }, pointInPixel) && pointInGrid) {\r\n let newPoint: { x: number, y: number } = {\r\n x: +pointInGrid[0].toFixed(3),\r\n y: +pointInGrid[1].toFixed(3)\r\n };\r\n this.chartHover.emit(newPoint);\r\n }\r\n /* Logic to change the cursor icon when the \"Click to Add Point\" feature is active and viceversa. */\r\n const option: any = ec.getOption();\r\n const addPointIsActive = option?.toolbox?.[0]?.feature?.myAddPoint?.iconStatus;\r\n if (addPointIsActive) {\r\n this.zr?.setCursorStyle(\r\n ec.containPixel({ gridIndex: 0 }, pointInPixel) ? 'copy' : 'default'\r\n );\r\n }\r\n });\r\n }\r\n\r\n}\r\n","// Angular General\r\nimport { Component, EventEmitter, Input, Output } from '@angular/core';\r\n// Kiwi Chart\r\nimport { Chart, BasePoint } from '../models/chart.models';\r\nimport { KiwiChartDirective } from '../directives/kiwi-chart.directive';\r\n\r\n@Component({\r\n selector: 'kiwi-chart',\r\n template: `\r\n <div \r\n kiwi-chart \r\n [chart]=\"chart\" \r\n [width]=\"width\"\r\n [height]=\"height\"\r\n [darkTheme]=\"darkTheme\"\r\n [darkThemeBackground]=\"darkThemeBackground\"\r\n (addPoint)=\"addPoint.emit($event)\"\r\n (chartHover)=\"chartHover.emit($event)\"\r\n ></div> \r\n `,\r\n styles: [``],\r\n imports: [KiwiChartDirective]\r\n})\r\nexport class KiwiChartComponent {\r\n\r\n /**\r\n * The Chart Object rendered by the canvas. For all the available options refer \r\n * to Chart interface in the models folder.\r\n *\r\n * @type {(Chart | null)}\r\n * @memberof KiwiChartComponent\r\n */\r\n @Input({ required: true }) chart: Chart | null = null;\r\n\r\n /**\r\n * Width and Height of the chart area. The dimensions refer to the father component \r\n * into which the kiwi-chart is inserted. For example in an empty page the width/height \r\n * of the chart can take the whole available space in the page.\r\n *\r\n * @type {string}\r\n * @memberof KiwiChartComponent\r\n */\r\n @Input() width: string = '100%';\r\n @Input() height: string = '480px';\r\n\r\n /**\r\n * This property simply activates or not the dark theme of the chart\r\n * defined by the Echarts library. In addition the background color can be custom\r\n * so that the chart can match the background of the application in which it's used.\r\n *\r\n * @type {boolean}\r\n * @memberof KiwiChartComponent\r\n */\r\n @Input() darkTheme: boolean = false;\r\n @Input() darkThemeBackground: string | null = null;\r\n\r\n /**\r\n * Output event used to emit to the father component the coordinates\r\n * of the point clicked in the chart area. This functionality to be used must\r\n * have the property \"clickToAddPoint\" in the Chart object set to true.\r\n *\r\n * @type {EventEmitter<BasePoint>}\r\n * @memberof KiwiChartComponent\r\n */\r\n @Output() addPoint: EventEmitter<BasePoint> = new EventEmitter<BasePoint>();\r\n\r\n /**\r\n * When the cursor hovers the chart area it emits to the father component the\r\n * x and y coordinates relative to the chart reference system.\r\n *\r\n * @type {EventEmitter<BasePoint>}\r\n * @memberof KiwiChartComponent\r\n */\r\n @Output() chartHover: EventEmitter<BasePoint> = new EventEmitter<BasePoint>();\r\n\r\n}\r\n","/*\r\n * Public API Surface of chart\r\n */\r\n\r\nexport * from './lib/components/chart.component';\r\nexport * from './lib/models/chart.models';","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;IA2JY;AAAZ,CAAA,UAAY,SAAS,EAAA;AACjB,IAAA,SAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACb,IAAA,SAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACvB,CAAC,EAHW,SAAS,KAAT,SAAS,GAAA,EAAA,CAAA,CAAA;IAKT;AAAZ,CAAA,UAAY,WAAW,EAAA;AACnB,IAAA,WAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACb,IAAA,WAAA,CAAA,QAAA,CAAA,GAAA,QAAiB;AACjB,IAAA,WAAA,CAAA,UAAA,CAAA,GAAA,UAAqB;AACrB,IAAA,WAAA,CAAA,KAAA,CAAA,GAAA,KAAW;AACX,IAAA,WAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACvB,CAAC,EANW,WAAW,KAAX,WAAW,GAAA,EAAA,CAAA,CAAA;IAQX;AAAZ,CAAA,UAAY,UAAU,EAAA;AAClB,IAAA,UAAA,CAAA,OAAA,CAAA,GAAA,OAAe;AACf,IAAA,UAAA,CAAA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AC,EAAE,QAAQ,EAAE,IAAI,EAAE;;sBAUxB;;sBACA;;sBAUA;;sBACA;;sBAUA;;sBASA;;;ACzEH;;AAEG;;ACFH;;AAEG;;;;"}
|
package/package.json
CHANGED
|
@@ -1,16 +1,28 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@kiwibit/chart",
|
|
3
|
-
"version": "
|
|
4
|
-
"engines": {
|
|
5
|
-
"node": "^
|
|
6
|
-
},
|
|
7
|
-
"peerDependencies": {
|
|
8
|
-
"@angular/common": "^
|
|
9
|
-
"@angular/core": "^
|
|
10
|
-
},
|
|
11
|
-
"dependencies": {
|
|
12
|
-
"echarts": "^
|
|
13
|
-
"tslib": "^2.3.0"
|
|
14
|
-
},
|
|
15
|
-
"
|
|
1
|
+
{
|
|
2
|
+
"name": "@kiwibit/chart",
|
|
3
|
+
"version": "21.0.0",
|
|
4
|
+
"engines": {
|
|
5
|
+
"node": "^20.19.0 || ^22.12.0 || ^24.0.0"
|
|
6
|
+
},
|
|
7
|
+
"peerDependencies": {
|
|
8
|
+
"@angular/common": "^21.0.0",
|
|
9
|
+
"@angular/core": "^21.0.0"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"echarts": "^6.0.0",
|
|
13
|
+
"tslib": "^2.3.0"
|
|
14
|
+
},
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"module": "fesm2022/kiwibit-chart.mjs",
|
|
17
|
+
"typings": "types/kiwibit-chart.d.ts",
|
|
18
|
+
"exports": {
|
|
19
|
+
"./package.json": {
|
|
20
|
+
"default": "./package.json"
|
|
21
|
+
},
|
|
22
|
+
".": {
|
|
23
|
+
"types": "./types/kiwibit-chart.d.ts",
|
|
24
|
+
"default": "./fesm2022/kiwibit-chart.mjs"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"sideEffects": false
|
|
16
28
|
}
|
|
@@ -1,183 +1,229 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
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-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
* @
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
* @
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
* @
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
* @
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
name?: string;
|
|
140
|
-
/**
|
|
141
|
-
* Symbol used to represent the point in the chart.
|
|
142
|
-
*
|
|
143
|
-
* @type {PointSymbol}
|
|
144
|
-
* @memberof Point
|
|
145
|
-
*/
|
|
146
|
-
symbol?: PointSymbol;
|
|
147
|
-
symbolSize?: number;
|
|
148
|
-
color?: string;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { EventEmitter } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Interface to define the Chart model.
|
|
6
|
+
*
|
|
7
|
+
* @export
|
|
8
|
+
* @interface Chart
|
|
9
|
+
*/
|
|
10
|
+
interface Chart {
|
|
11
|
+
title: string;
|
|
12
|
+
showLegend?: boolean;
|
|
13
|
+
xAxisType: AxisType;
|
|
14
|
+
xAxisName: string;
|
|
15
|
+
xAxisUom?: string;
|
|
16
|
+
xMin?: number;
|
|
17
|
+
xMax?: number;
|
|
18
|
+
yAxisType: AxisType;
|
|
19
|
+
yAxisName: string;
|
|
20
|
+
yAxisUom?: string;
|
|
21
|
+
yMin?: number;
|
|
22
|
+
yMax?: number;
|
|
23
|
+
/**
|
|
24
|
+
* The maximum decimals that can have the values on the x and y axes.
|
|
25
|
+
* If omitted the default is 3 decimals.
|
|
26
|
+
*
|
|
27
|
+
* @type {number}
|
|
28
|
+
* @memberof Chart
|
|
29
|
+
*/
|
|
30
|
+
maxAxesDecimals?: number;
|
|
31
|
+
/**
|
|
32
|
+
* If the chart should have rendering animations.
|
|
33
|
+
*
|
|
34
|
+
* @type {boolean}
|
|
35
|
+
* @memberof Chart
|
|
36
|
+
*/
|
|
37
|
+
hasAnimations?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* How long the animation should last.
|
|
40
|
+
* Expressed in milliseconds. If omitted the Default is 500 ms.
|
|
41
|
+
*
|
|
42
|
+
* @type {number}
|
|
43
|
+
* @memberof Chart
|
|
44
|
+
*/
|
|
45
|
+
animationDuration?: number;
|
|
46
|
+
/**
|
|
47
|
+
* The list of Shapes that the chart must render.
|
|
48
|
+
* Each Shape corrisponds to a single chart component.
|
|
49
|
+
*
|
|
50
|
+
* @type {Shape[]}
|
|
51
|
+
* @memberof Chart
|
|
52
|
+
*/
|
|
53
|
+
shapes: Shape[];
|
|
54
|
+
/**
|
|
55
|
+
* Adds interaction with the chart, so that when clicking
|
|
56
|
+
* everywhere in the chart area a point gets added and it's coordinate are
|
|
57
|
+
* emitted with an event to the parent component.
|
|
58
|
+
*
|
|
59
|
+
* @type {boolean}
|
|
60
|
+
* @memberof Chart
|
|
61
|
+
*/
|
|
62
|
+
clickToAddPoint?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Custom name for the "clickToAddPoint" event related button.
|
|
65
|
+
*
|
|
66
|
+
* @type {string}
|
|
67
|
+
* @memberof Chart
|
|
68
|
+
*/
|
|
69
|
+
addPointCustomName?: string;
|
|
70
|
+
/**
|
|
71
|
+
* Adds the possibility to use the scroll
|
|
72
|
+
* to zoom in/out the chart area.
|
|
73
|
+
*
|
|
74
|
+
* @type {boolean}
|
|
75
|
+
* @memberof Chart
|
|
76
|
+
*/
|
|
77
|
+
scrollToZoom?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Tells the chart to render or not the grid lines.
|
|
80
|
+
*
|
|
81
|
+
* @type {boolean}
|
|
82
|
+
* @memberof Chart
|
|
83
|
+
*/
|
|
84
|
+
showGrid?: boolean;
|
|
85
|
+
}
|
|
86
|
+
type Shape = Trace;
|
|
87
|
+
interface Trace {
|
|
88
|
+
name?: string;
|
|
89
|
+
/**
|
|
90
|
+
* The variant of the Shape, must be of type Trace.
|
|
91
|
+
*
|
|
92
|
+
* @type {ShapeVariant}
|
|
93
|
+
* @memberof Trace
|
|
94
|
+
*/
|
|
95
|
+
variant: ShapeVariant;
|
|
96
|
+
color?: string;
|
|
97
|
+
/**
|
|
98
|
+
* The type of the Trace drawn by the chart.
|
|
99
|
+
* Can be a line or a scatter.
|
|
100
|
+
*
|
|
101
|
+
* @type {TraceType}
|
|
102
|
+
* @memberof Trace
|
|
103
|
+
*/
|
|
104
|
+
type: TraceType;
|
|
105
|
+
width?: number;
|
|
106
|
+
/**
|
|
107
|
+
* The list of points that define the Trace.
|
|
108
|
+
*
|
|
109
|
+
* @type {Point[]}
|
|
110
|
+
* @memberof Trace
|
|
111
|
+
*/
|
|
112
|
+
points: Point[];
|
|
113
|
+
/**
|
|
114
|
+
* Whether to show a smooth curve or a segmented curve.
|
|
115
|
+
*
|
|
116
|
+
* @type {boolean}
|
|
117
|
+
* @memberof Trace
|
|
118
|
+
*/
|
|
119
|
+
smooth?: boolean;
|
|
120
|
+
/**
|
|
121
|
+
* The style of the Trace.
|
|
122
|
+
* Can be solid, dashed or dotted.
|
|
123
|
+
*
|
|
124
|
+
* @type {TraceStyle}
|
|
125
|
+
* @memberof Trace
|
|
126
|
+
*/
|
|
127
|
+
style?: TraceStyle;
|
|
128
|
+
/**
|
|
129
|
+
* Option to make the Trace selected/deselected by default.
|
|
130
|
+
* A deselected Trace is obscured from the chart and can be toggled from the legend.
|
|
131
|
+
*
|
|
132
|
+
* @type {boolean}
|
|
133
|
+
* @memberof Trace
|
|
134
|
+
*/
|
|
135
|
+
selectedByDefault?: boolean;
|
|
136
|
+
opacity?: number;
|
|
137
|
+
}
|
|
138
|
+
interface Point extends BasePoint {
|
|
139
|
+
name?: string;
|
|
140
|
+
/**
|
|
141
|
+
* Symbol used to represent the point in the chart.
|
|
142
|
+
*
|
|
143
|
+
* @type {PointSymbol}
|
|
144
|
+
* @memberof Point
|
|
145
|
+
*/
|
|
146
|
+
symbol?: PointSymbol;
|
|
147
|
+
symbolSize?: number;
|
|
148
|
+
color?: string;
|
|
149
|
+
}
|
|
150
|
+
interface BasePoint {
|
|
151
|
+
x: number;
|
|
152
|
+
y: number;
|
|
153
|
+
}
|
|
154
|
+
declare enum TraceType {
|
|
155
|
+
LINE = "line",
|
|
156
|
+
SCATTER = "scatter"
|
|
157
|
+
}
|
|
158
|
+
declare enum PointSymbol {
|
|
159
|
+
NONE = "none",
|
|
160
|
+
CIRCLE = "circle",
|
|
161
|
+
TRIANGLE = "triangle",
|
|
162
|
+
PIN = "pin",
|
|
163
|
+
DIAMOND = "diamond"
|
|
164
|
+
}
|
|
165
|
+
declare enum TraceStyle {
|
|
166
|
+
SOLID = "solid",
|
|
167
|
+
DASHED = "dashed",
|
|
168
|
+
DOTTED = "dotted"
|
|
169
|
+
}
|
|
170
|
+
declare enum AxisType {
|
|
171
|
+
VALUE = "value"
|
|
172
|
+
}
|
|
173
|
+
declare enum ShapeVariant {
|
|
174
|
+
TRACE = 0
|
|
175
|
+
}
|
|
176
|
+
type ChartTheme = 'default' | 'dark';
|
|
177
|
+
|
|
178
|
+
declare class KiwiChartComponent {
|
|
179
|
+
/**
|
|
180
|
+
* The Chart Object rendered by the canvas. For all the available options refer
|
|
181
|
+
* to Chart interface in the models folder.
|
|
182
|
+
*
|
|
183
|
+
* @type {(Chart | null)}
|
|
184
|
+
* @memberof KiwiChartComponent
|
|
185
|
+
*/
|
|
186
|
+
chart: Chart | null;
|
|
187
|
+
/**
|
|
188
|
+
* Width and Height of the chart area. The dimensions refer to the father component
|
|
189
|
+
* into which the kiwi-chart is inserted. For example in an empty page the width/height
|
|
190
|
+
* of the chart can take the whole available space in the page.
|
|
191
|
+
*
|
|
192
|
+
* @type {string}
|
|
193
|
+
* @memberof KiwiChartComponent
|
|
194
|
+
*/
|
|
195
|
+
width: string;
|
|
196
|
+
height: string;
|
|
197
|
+
/**
|
|
198
|
+
* This property simply activates or not the dark theme of the chart
|
|
199
|
+
* defined by the Echarts library. In addition the background color can be custom
|
|
200
|
+
* so that the chart can match the background of the application in which it's used.
|
|
201
|
+
*
|
|
202
|
+
* @type {boolean}
|
|
203
|
+
* @memberof KiwiChartComponent
|
|
204
|
+
*/
|
|
205
|
+
darkTheme: boolean;
|
|
206
|
+
darkThemeBackground: string | null;
|
|
207
|
+
/**
|
|
208
|
+
* Output event used to emit to the father component the coordinates
|
|
209
|
+
* of the point clicked in the chart area. This functionality to be used must
|
|
210
|
+
* have the property "clickToAddPoint" in the Chart object set to true.
|
|
211
|
+
*
|
|
212
|
+
* @type {EventEmitter<BasePoint>}
|
|
213
|
+
* @memberof KiwiChartComponent
|
|
214
|
+
*/
|
|
215
|
+
addPoint: EventEmitter<BasePoint>;
|
|
216
|
+
/**
|
|
217
|
+
* When the cursor hovers the chart area it emits to the father component the
|
|
218
|
+
* x and y coordinates relative to the chart reference system.
|
|
219
|
+
*
|
|
220
|
+
* @type {EventEmitter<BasePoint>}
|
|
221
|
+
* @memberof KiwiChartComponent
|
|
222
|
+
*/
|
|
223
|
+
chartHover: EventEmitter<BasePoint>;
|
|
224
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<KiwiChartComponent, never>;
|
|
225
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<KiwiChartComponent, "kiwi-chart", never, { "chart": { "alias": "chart"; "required": true; }; "width": { "alias": "width"; "required": false; }; "height": { "alias": "height"; "required": false; }; "darkTheme": { "alias": "darkTheme"; "required": false; }; "darkThemeBackground": { "alias": "darkThemeBackground"; "required": false; }; }, { "addPoint": "addPoint"; "chartHover": "chartHover"; }, never, never, true, never>;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export { AxisType, KiwiChartComponent, PointSymbol, ShapeVariant, TraceStyle, TraceType };
|
|
229
|
+
export type { BasePoint, Chart, ChartTheme, Point, Shape, Trace };
|