minerva-design 1.13.2 → 1.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/custom-elements.json +194 -12
- package/dist/angular/fesm2022/minerva-angular.mjs +20 -0
- package/dist/angular/fesm2022/minerva-angular.mjs.map +1 -1
- package/dist/angular/types/minerva-angular.d.ts +10 -1
- package/dist/charts/canvas.d.cts +1 -0
- package/dist/charts/canvas.d.ts +1 -0
- package/dist/charts/engine/canvas.cjs +1 -1
- package/dist/charts/engine/canvas.cjs.map +1 -1
- package/dist/charts/engine/canvas.js +152 -128
- package/dist/charts/engine/canvas.js.map +1 -1
- package/dist/charts/engine/chart.cjs +1 -1
- package/dist/charts/engine/chart.cjs.map +1 -1
- package/dist/charts/engine/chart.js +475 -405
- package/dist/charts/engine/chart.js.map +1 -1
- package/dist/charts/engine/controller.cjs +2 -2
- package/dist/charts/engine/controller.cjs.map +1 -1
- package/dist/charts/engine/controller.js +263 -248
- package/dist/charts/engine/controller.js.map +1 -1
- package/dist/charts/engine/dom.cjs +1 -1
- package/dist/charts/engine/dom.cjs.map +1 -1
- package/dist/charts/engine/dom.d.cts +34 -0
- package/dist/charts/engine/dom.d.ts +34 -0
- package/dist/charts/engine/dom.js +62 -51
- package/dist/charts/engine/dom.js.map +1 -1
- package/dist/charts/engine/graph/chart.cjs +1 -1
- package/dist/charts/engine/graph/chart.cjs.map +1 -1
- package/dist/charts/engine/graph/chart.js +835 -821
- package/dist/charts/engine/graph/chart.js.map +1 -1
- package/dist/charts/engine/graph/dom.cjs +1 -1
- package/dist/charts/engine/graph/dom.cjs.map +1 -1
- package/dist/charts/engine/graph/dom.js +44 -51
- package/dist/charts/engine/graph/dom.js.map +1 -1
- package/dist/charts/engine/hover-rect.cjs +2 -0
- package/dist/charts/engine/hover-rect.cjs.map +1 -0
- package/dist/charts/engine/hover-rect.d.cts +10 -0
- package/dist/charts/engine/hover-rect.d.ts +10 -0
- package/dist/charts/engine/hover-rect.js +47 -0
- package/dist/charts/engine/hover-rect.js.map +1 -0
- package/dist/charts/engine/items.cjs +1 -1
- package/dist/charts/engine/items.cjs.map +1 -1
- package/dist/charts/engine/items.js +8 -8
- package/dist/charts/engine/model.cjs +1 -1
- package/dist/charts/engine/model.cjs.map +1 -1
- package/dist/charts/engine/model.js +191 -191
- package/dist/charts/engine/model.js.map +1 -1
- package/dist/charts/engine/orderbook/depth.cjs +1 -1
- package/dist/charts/engine/orderbook/depth.cjs.map +1 -1
- package/dist/charts/engine/orderbook/depth.js +63 -63
- package/dist/charts/engine/orderbook/heatmap.cjs +1 -1
- package/dist/charts/engine/orderbook/heatmap.cjs.map +1 -1
- package/dist/charts/engine/orderbook/heatmap.js +155 -155
- package/dist/charts/engine/orderbook/host.cjs +1 -1
- package/dist/charts/engine/orderbook/host.cjs.map +1 -1
- package/dist/charts/engine/orderbook/host.js +87 -75
- package/dist/charts/engine/orderbook/host.js.map +1 -1
- package/dist/charts/engine/orderbook/ladder.cjs +1 -1
- package/dist/charts/engine/orderbook/ladder.cjs.map +1 -1
- package/dist/charts/engine/orderbook/ladder.js +41 -41
- package/dist/charts/engine/orderbook/tape.cjs +1 -1
- package/dist/charts/engine/orderbook/tape.cjs.map +1 -1
- package/dist/charts/engine/orderbook/tape.js +31 -31
- package/dist/charts/engine/presets.cjs +2 -2
- package/dist/charts/engine/presets.cjs.map +1 -1
- package/dist/charts/engine/presets.js +15 -15
- package/dist/charts/engine/renderers/vector-gpu.cjs +24 -0
- package/dist/charts/engine/renderers/vector-gpu.cjs.map +1 -0
- package/dist/charts/engine/renderers/vector-gpu.d.cts +22 -0
- package/dist/charts/engine/renderers/vector-gpu.d.ts +22 -0
- package/dist/charts/engine/renderers/vector-gpu.js +301 -0
- package/dist/charts/engine/renderers/vector-gpu.js.map +1 -0
- package/dist/charts/engine/renderers/vector.cjs +2 -0
- package/dist/charts/engine/renderers/vector.cjs.map +1 -0
- package/dist/charts/engine/renderers/vector.d.cts +140 -0
- package/dist/charts/engine/renderers/vector.d.ts +140 -0
- package/dist/charts/engine/renderers/vector.js +568 -0
- package/dist/charts/engine/renderers/vector.js.map +1 -0
- package/dist/charts/engine/scene.cjs +1 -1
- package/dist/charts/engine/scene.cjs.map +1 -1
- package/dist/charts/engine/scene.d.cts +43 -3
- package/dist/charts/engine/scene.d.ts +43 -3
- package/dist/charts/engine/scene.js +411 -338
- package/dist/charts/engine/scene.js.map +1 -1
- package/dist/charts/engine/shapes/bullet.cjs +1 -1
- package/dist/charts/engine/shapes/bullet.cjs.map +1 -1
- package/dist/charts/engine/shapes/bullet.js +36 -36
- package/dist/charts/engine/shapes/calendar.cjs +1 -1
- package/dist/charts/engine/shapes/calendar.cjs.map +1 -1
- package/dist/charts/engine/shapes/calendar.js +53 -53
- package/dist/charts/engine/shapes/chart.cjs +1 -1
- package/dist/charts/engine/shapes/chart.cjs.map +1 -1
- package/dist/charts/engine/shapes/chart.d.cts +3 -2
- package/dist/charts/engine/shapes/chart.d.ts +3 -2
- package/dist/charts/engine/shapes/chart.js +192 -162
- package/dist/charts/engine/shapes/chart.js.map +1 -1
- package/dist/charts/engine/shapes/draw.cjs +1 -1
- package/dist/charts/engine/shapes/draw.cjs.map +1 -1
- package/dist/charts/engine/shapes/draw.js +87 -86
- package/dist/charts/engine/shapes/draw.js.map +1 -1
- package/dist/charts/engine/shapes/layout.cjs +2 -2
- package/dist/charts/engine/shapes/layout.cjs.map +1 -1
- package/dist/charts/engine/shapes/layout.d.cts +8 -7
- package/dist/charts/engine/shapes/layout.d.ts +8 -7
- package/dist/charts/engine/shapes/layout.js +262 -166
- package/dist/charts/engine/shapes/layout.js.map +1 -1
- package/dist/charts/engine/shapes/types.d.cts +13 -1
- package/dist/charts/engine/shapes/types.d.ts +13 -1
- package/dist/charts/engine/three-d/chart.cjs +1 -1
- package/dist/charts/engine/three-d/chart.cjs.map +1 -1
- package/dist/charts/engine/three-d/chart.js +266 -257
- package/dist/charts/engine/three-d/chart.js.map +1 -1
- package/dist/charts/engine/three-d/dom.cjs +1 -1
- package/dist/charts/engine/three-d/dom.cjs.map +1 -1
- package/dist/charts/engine/three-d/dom.js +28 -35
- package/dist/charts/engine/three-d/dom.js.map +1 -1
- package/dist/charts/engine/three-d/geometry.cjs +1 -1
- package/dist/charts/engine/three-d/geometry.cjs.map +1 -1
- package/dist/charts/engine/three-d/geometry.js +70 -70
- package/dist/charts/engine/three-d/overlay.cjs +1 -1
- package/dist/charts/engine/three-d/overlay.cjs.map +1 -1
- package/dist/charts/engine/three-d/overlay.js +15 -15
- package/dist/charts/engine/tooltip.cjs +2 -0
- package/dist/charts/engine/tooltip.cjs.map +1 -0
- package/dist/charts/engine/tooltip.d.cts +94 -0
- package/dist/charts/engine/tooltip.d.ts +94 -0
- package/dist/charts/engine/tooltip.js +242 -0
- package/dist/charts/engine/tooltip.js.map +1 -0
- package/dist/charts/engine/trading/chart.cjs +1 -1
- package/dist/charts/engine/trading/chart.cjs.map +1 -1
- package/dist/charts/engine/trading/chart.js +135 -135
- package/dist/charts/react/shapes.cjs +1 -1
- package/dist/charts/react/shapes.cjs.map +1 -1
- package/dist/charts/react/shapes.d.cts +10 -1
- package/dist/charts/react/shapes.d.ts +10 -1
- package/dist/charts/react/shapes.js +24 -19
- package/dist/charts/react/shapes.js.map +1 -1
- package/dist/core/contracts.cjs +1 -1
- package/dist/core/contracts.cjs.map +1 -1
- package/dist/core/contracts.js +1 -1
- package/dist/core/contracts.js.map +1 -1
- package/dist/native/charts/src/canvas.cjs +1 -1
- package/dist/native/charts/src/canvas.js +8 -7
- package/dist/native/charts/src/engine/canvas.cjs +1 -1
- package/dist/native/charts/src/engine/canvas.js +2 -0
- package/dist/native/charts/src/engine/controller.cjs +2 -2
- package/dist/native/charts/src/engine/controller.cjs.map +1 -1
- package/dist/native/charts/src/engine/controller.js +102 -87
- package/dist/native/charts/src/engine/controller.js.map +1 -1
- package/dist/native/charts/src/engine/hover-rect.cjs +2 -0
- package/dist/native/charts/src/engine/hover-rect.cjs.map +1 -0
- package/dist/native/charts/src/engine/hover-rect.js +47 -0
- package/dist/native/charts/src/engine/hover-rect.js.map +1 -0
- package/dist/native/charts/src/engine/scene.cjs +1 -1
- package/dist/native/charts/src/engine/scene.cjs.map +1 -1
- package/dist/native/charts/src/engine/scene.js +318 -245
- package/dist/native/charts/src/engine/scene.js.map +1 -1
- package/dist/native/charts/src/engine/shapes/draw.cjs +1 -1
- package/dist/native/charts/src/engine/shapes/draw.cjs.map +1 -1
- package/dist/native/charts/src/engine/shapes/draw.js +81 -80
- package/dist/native/charts/src/engine/shapes/draw.js.map +1 -1
- package/dist/native/charts/src/engine/shapes/layout.cjs +2 -2
- package/dist/native/charts/src/engine/shapes/layout.cjs.map +1 -1
- package/dist/native/charts/src/engine/shapes/layout.js +239 -143
- package/dist/native/charts/src/engine/shapes/layout.js.map +1 -1
- package/dist/native/charts/src/engine/tooltip.cjs +2 -0
- package/dist/native/charts/src/engine/tooltip.cjs.map +1 -0
- package/dist/native/charts/src/engine/tooltip.js +164 -0
- package/dist/native/charts/src/engine/tooltip.js.map +1 -0
- package/dist/native/components/Chart/scene.cjs +1 -1
- package/dist/native/components/Chart/scene.cjs.map +1 -1
- package/dist/native/components/Chart/scene.js +210 -187
- package/dist/native/components/Chart/scene.js.map +1 -1
- package/dist/native/source/components/Chart/scene.tsx +55 -2
- package/dist/taro/index.js +2026 -1626
- package/dist/uni/charts-canvas.js +1 -0
- package/dist/vue/components/Chart/BulletChart.vue.d.ts +2 -0
- package/dist/vue/components/Chart/CalendarHeatmap.vue.d.ts +2 -0
- package/dist/vue/components/Chart/ChordChart.vue.d.ts +2 -0
- package/dist/vue/components/Chart/DonutChart.vue.d.ts +2 -0
- package/dist/vue/components/Chart/FunnelChart.vue.d.ts +2 -0
- package/dist/vue/components/Chart/GaugeChart.vue.d.ts +2 -0
- package/dist/vue/components/Chart/PieChart.vue.d.ts +2 -0
- package/dist/vue/components/Chart/RadarChart.vue.d.ts +2 -0
- package/dist/vue/components/Chart/RadialBarChart.vue.d.ts +2 -0
- package/dist/vue/components/Chart/SankeyChart.vue.d.ts +2 -0
- package/dist/vue/components/Chart/SunburstChart.vue.d.ts +2 -0
- package/dist/vue/components/Chart/TreemapChart.vue.d.ts +2 -0
- package/dist/vue/components/Chart/props.d.ts +2 -0
- package/dist/vue/components/Chart/props.js +1 -0
- package/dist/vue/components/Chart/props.js.map +1 -1
- package/dist/vue/components/Chart/shape.d.ts +2 -1
- package/dist/vue/components/Chart/shape.js +2 -0
- package/dist/vue/components/Chart/shape.js.map +1 -1
- package/dist/vue/components/Chart/types.d.ts +2 -0
- package/dist/weapp/charts/canvas.js +2576 -1969
- package/dist/weapp/charts/core.js +1 -0
- package/dist/web-components/components/chart/shape-chart.d.ts +9 -7
- package/dist/web-components/components/chart/shape-chart.js +3 -0
- package/dist/web-components/components/chart/shape-chart.js.map +1 -1
- package/dist/web-components/components/chart/shapes-extended.d.ts +6 -6
- package/dist/web-components/components/chart/shapes-extended.js.map +1 -1
- package/package.json +1 -1
|
@@ -9490,7 +9490,7 @@ export declare class MnQuadrantChart extends MnCartesianChartBase {
|
|
|
9490
9490
|
}
|
|
9491
9491
|
/**
|
|
9492
9492
|
* Base of the shape chart components (engine `createShapeChart`): hover,
|
|
9493
|
-
* click and toggle outputs
|
|
9493
|
+
* click and toggle outputs, the `toggle()` and `getRenderer()` methods.
|
|
9494
9494
|
*/
|
|
9495
9495
|
export declare abstract class MnShapeChartBase extends MnChartEngine<ShapeChartOptions, ShapeChartInstance> {
|
|
9496
9496
|
/** The hovered (or keyboard-focused) mark changed (`null`: none) */
|
|
@@ -9503,6 +9503,8 @@ export declare abstract class MnShapeChartBase extends MnChartEngine<ShapeChartO
|
|
|
9503
9503
|
protected bindEngine(chart: ShapeChartInstance): Array<() => void>;
|
|
9504
9504
|
/** Hides / shows a slice, stage, radar series or top-level treemap node by index */
|
|
9505
9505
|
toggle(index: number): void;
|
|
9506
|
+
/** Backend drawing the shapes, `null` until ready */
|
|
9507
|
+
getRenderer(): ChartRendererKind | null;
|
|
9506
9508
|
static ɵfac: i0.ɵɵFactoryDeclaration<MnShapeChartBase, never>;
|
|
9507
9509
|
static ɵdir: i0.ɵɵDirectiveDeclaration<MnShapeChartBase, never, never, {}, {
|
|
9508
9510
|
"hover": "hover";
|
|
@@ -9512,6 +9514,8 @@ export declare abstract class MnShapeChartBase extends MnChartEngine<ShapeChartO
|
|
|
9512
9514
|
}
|
|
9513
9515
|
/** Base of the named shape charts: the inputs shared by every type */
|
|
9514
9516
|
export declare abstract class MnShapeChartCommon extends MnShapeChartBase {
|
|
9517
|
+
/** Backend of the shapes: `auto` tries WebGPU, then WebGL2, then WebGL, then Canvas2D, skipping GPUs running in software; text is always drawn with Canvas2D (default `auto`, see `setDefaultChartRenderer`) */
|
|
9518
|
+
readonly renderer: import("@angular/core").InputSignal<ChartRendererPreference | undefined>;
|
|
9515
9519
|
/** Colors of the marks without `color` (defaults to the `--chart-series-1..8` CSS variables, then the theme colors) */
|
|
9516
9520
|
readonly palette: import("@angular/core").InputSignal<readonly string[] | undefined>;
|
|
9517
9521
|
/** Legend; clicking an item hides / shows its entry (shown by default for pie, donut, funnel and multi-series radar charts) */
|
|
@@ -9537,6 +9541,11 @@ export declare abstract class MnShapeChartCommon extends MnShapeChartBase {
|
|
|
9537
9541
|
protected commonOptions(): ShapeChartCommonOptions;
|
|
9538
9542
|
static ɵfac: i0.ɵɵFactoryDeclaration<MnShapeChartCommon, never>;
|
|
9539
9543
|
static ɵdir: i0.ɵɵDirectiveDeclaration<MnShapeChartCommon, never, never, {
|
|
9544
|
+
"renderer": {
|
|
9545
|
+
"alias": "renderer";
|
|
9546
|
+
"required": false;
|
|
9547
|
+
"isSignal": true;
|
|
9548
|
+
};
|
|
9540
9549
|
"palette": {
|
|
9541
9550
|
"alias": "palette";
|
|
9542
9551
|
"required": false;
|
package/dist/charts/canvas.d.cts
CHANGED
|
@@ -7,6 +7,7 @@ export { areaTitleLayout as annotationTitleLayout, lineOf as annotationLine, rec
|
|
|
7
7
|
export { toData, toScreen } from './engine/layout.cjs';
|
|
8
8
|
export { binValues, boxplotData, boxplotStats, bubbleSeries, ganttSeries, histogramSeries, quantiles, waterfallSeries, type BinOptions, type BoxplotGroup, type BoxplotStats, type BoxplotStatsOptions, type BubbleOptions, type GanttOptions, type GanttSeries, type GanttTask, type HistogramBinning, type HistogramBins, type HistogramSeriesOptions, type WaterfallOptions, type WaterfallStep, boxplotSeries, rangeAreaSeries, areaSeries, barSeries, candlestickSeries, DEFAULT_QUADRANT_COLORS, heatmapChartOptions, lineSeries, quadrantCenter, quadrantChartOptions, quadrantCountText, quadrantGroups, quadrantLabels, quadrantOf, scatterSeries, sparklineOptions, withSeriesType, type LineSeriesOptions, type HeatmapCell, type HeatmapConfig, type QuadrantAxisLabels, type QuadrantChartState, type QuadrantConfig, type QuadrantCorner, type QuadrantGroup, type QuadrantLabels, type QuadrantPoint, type QuadrantRegion, type QuadrantRegions, type SparklineConfig, } from './engine/presets.cjs';
|
|
9
9
|
export { toCss } from './engine/color.cjs';
|
|
10
|
+
export { liftedBarRect, type BarHoverMark } from './engine/scene.cjs';
|
|
10
11
|
export type { ChartThemeInput } from './engine/theme.cjs';
|
|
11
12
|
export type * from './engine/types.cjs';
|
|
12
13
|
export { createCanvasShapeChart, type CanvasShapeChartConfig, type CanvasShapeChartInstance, } from './engine/shapes/canvas.cjs';
|
package/dist/charts/canvas.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export { areaTitleLayout as annotationTitleLayout, lineOf as annotationLine, rec
|
|
|
7
7
|
export { toData, toScreen } from './engine/layout.js';
|
|
8
8
|
export { binValues, boxplotData, boxplotStats, bubbleSeries, ganttSeries, histogramSeries, quantiles, waterfallSeries, type BinOptions, type BoxplotGroup, type BoxplotStats, type BoxplotStatsOptions, type BubbleOptions, type GanttOptions, type GanttSeries, type GanttTask, type HistogramBinning, type HistogramBins, type HistogramSeriesOptions, type WaterfallOptions, type WaterfallStep, boxplotSeries, rangeAreaSeries, areaSeries, barSeries, candlestickSeries, DEFAULT_QUADRANT_COLORS, heatmapChartOptions, lineSeries, quadrantCenter, quadrantChartOptions, quadrantCountText, quadrantGroups, quadrantLabels, quadrantOf, scatterSeries, sparklineOptions, withSeriesType, type LineSeriesOptions, type HeatmapCell, type HeatmapConfig, type QuadrantAxisLabels, type QuadrantChartState, type QuadrantConfig, type QuadrantCorner, type QuadrantGroup, type QuadrantLabels, type QuadrantPoint, type QuadrantRegion, type QuadrantRegions, type SparklineConfig, } from './engine/presets.js';
|
|
9
9
|
export { toCss } from './engine/color.js';
|
|
10
|
+
export { liftedBarRect, type BarHoverMark } from './engine/scene.js';
|
|
10
11
|
export type { ChartThemeInput } from './engine/theme.js';
|
|
11
12
|
export type * from './engine/types.js';
|
|
12
13
|
export { createCanvasShapeChart, type CanvasShapeChartConfig, type CanvasShapeChartInstance, } from './engine/shapes/canvas.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("./color.cjs"),t=require("./items.cjs"),n=require("./overlay.cjs"),r=require("./renderers/canvas2d.cjs"),i=require("./signature.cjs"),a=require("./controller.cjs");var o=e=>(e[0]+e[1])/2,s=(e,t,n,r,i,a)=>{e.beginPath(),e.moveTo(t+a,n),e.lineTo(t+r-a,n),e.arcTo(t+r,n,t+r,n+a,a),e.lineTo(t+r,n+i-a),e.arcTo(t+r,n+i,t+r-a,n+i,a),e.lineTo(t+a,n+i),e.arcTo(t,n+i,t,n+i-a,a),e.lineTo(t,n+a),e.arcTo(t,n,t+a,n,a),e.closePath()},c=(e,t,n)=>{e.save(),e.beginPath(),e.rect(n.x,n.y,n.width,n.height),e.clip(),e.lineJoin=`round`,e.lineCap=`round`;for(let n of t)if(n.kind===`area`)e.globalAlpha=n.opacity,e.fillStyle=n.color,n.segments.forEach((t,r)=>{let i=n.bottoms?.[r],a=t.length/2;if(!(a<2)){e.beginPath();for(let n=0;n<a;n++)n===0?e.moveTo(t[0],t[1]):e.lineTo(t[n*2],t[n*2+1]);for(let r=a-1;r>=0;r--){let a=i?i[r]:n.baseline;n.horizontal?e.lineTo(a,t[r*2+1]):e.lineTo(t[r*2],a)}e.closePath(),e.fill()}}),e.globalAlpha=1;else if(n.kind===`line`){e.strokeStyle=n.color,e.lineWidth=n.width,e.beginPath();for(let t of n.segments)for(let n=0;n<t.length;n+=2)n===0?e.moveTo(t[0],t[1]):e.lineTo(t[n],t[n+1]);e.stroke()}else if(n.kind===`bars`){e.globalAlpha=n.opacity??1;let t=n.radius??0;for(let r=0;r<n.rects.length;r+=4){let[i,a,o,c]=[n.rects[r],n.rects[r+1],n.rects[r+2],n.rects[r+3]];e.fillStyle=n.colors?.[r/4]??n.color;let l=Math.min(t,o/2,c/2);l>.5?(s(e,i,a,o,c,l),e.fill()):e.fillRect(i,a,o,c)}e.globalAlpha=1}else{let t=n.stroke??0;for(let r=0;r<n.dots.length;r+=3){let i=n.colors[r/3]??`#888`,a=n.dots[r+2]/2;e.beginPath(),e.arc(n.dots[r],n.dots[r+1],Math.max(0,a-t/2),0,Math.PI*2),n.opacity>0&&(e.globalAlpha=n.opacity,e.fillStyle=i,e.fill()),t>0&&(e.globalAlpha=1,e.lineWidth=t,e.strokeStyle=i,e.stroke())}e.globalAlpha=1}e.restore()},l=(t,r,i)=>{let{theme:a}=i,{bar:o,stops:c}=r,l=c.length;if(typeof t.createLinearGradient==`function`){let e=t.createLinearGradient(o.x,0,o.x+o.width,0);c.forEach((t,n)=>e.addColorStop(n/Math.max(1,l-1),t)),t.fillStyle=e,s(t,o.x,o.y,o.width,o.height,o.height/2),t.fill()}else{let e=o.width/l;c.forEach((n,r)=>{t.fillStyle=n,t.fillRect(o.x+r*e,o.y,e+.5,o.height)})}t.fillStyle=e.toCss(a.text,.35);for(let e of r.ticks)t.fillRect(Math.round(e),o.y-2,1,o.height+4);t.font=n.font(a,11),t.textBaseline=`middle`,t.fillStyle=e.toCss(a.textMuted);for(let e of r.labels)t.textAlign=e.align,t.fillText(e.text,e.x,e.y);r.caret!==null&&(s(t,r.caret-2,o.y-3,4,o.height+6,2),t.fillStyle=e.toCss(a.text),t.fill(),t.lineWidth=1.5,t.strokeStyle=e.toCss(a.background),t.stroke())},u=(t,i,o,u,d,f=r.createCanvas2dPainter(t))=>{let{width:p,height:m,theme:h,model:g,view:_,layout:v}=i,{plot:y,scales:b}=v,x=d;t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,Math.ceil(p*x),Math.ceil(m*x)),t.setTransform(x,0,0,x,0,0),n.drawBackground(t,{width:p,height:m,scales:b,x:g.x,y:g.y,xTicks:v.xTicks,yTicks:v.yTicks,y2:g.y2,y2Ticks:v.y2Ticks,theme:h,annotations:i.annotations});let S=i.legend?.colors;if(S&&l(t,S,i),i.legend){t.font=n.font(h,12),t.textBaseline=`middle`,t.textAlign=`left`;for(let n of i.legend.entries){let r=n.box.y+n.box.height/2;if(t.globalAlpha=n.hidden?.45:1,t.fillStyle=n.color,n.shape===`dot`?(t.beginPath(),t.arc(n.box.x+5,r,4,0,Math.PI*2),t.fill()):n.shape===`line`?t.fillRect(n.box.x,r-1,10,2):t.fillRect(n.box.x+1,r-4,8,8),t.fillStyle=e.toCss(h.textMuted),t.fillText(n.name,n.box.x+14,r),n.hidden){let e=n.box.width-22;t.fillRect(n.box.x+14,r,e,1)}}t.globalAlpha=1}for(let n of i.hover?.marks??[])n.kind===`band`&&(s(t,n.x,n.y,n.width,n.height,6),t.fillStyle=e.toCss(h.text,.06),t.fill());b.horizontal?c(t,a.scenePrimitives(i),y):C();function C(){let e=(e,t,n)=>{let r=2/(e[1]-e[0]),i=(t-e[0])*r-1;return n?[-r,-i]:[r,i]},[t,n]=e(_.x,u.x,g.x.reverse),[r,i]=e(_.y,u.y,g.y.reverse);f.paint(o,{transform:{xScale:t,xOffset:n,yScale:r,yOffset:i},width:Math.max(1,Math.round(y.width*x)),height:Math.max(1,Math.round(y.height*x)),dpr:x},Math.round(y.x*x),Math.round(y.y*x))}t.setTransform(x,0,0,x,0,0);for(let n of i.hover?.marks??[])n.kind===`guide`&&(t.fillStyle=e.toCss(h.text,.06),t.fillRect(n.x,n.y,n.width,n.height));if(n.drawForeground(t,{width:p,height:m,scales:b,theme:h,annotations:i.annotations,pointLabels:[],clear:!1,connectors:i.connectors,arrows:i.arrows}),i.pointLabels.length){t.save(),t.font=n.font(h),t.textAlign=`left`,t.textBaseline=`middle`,t.lineWidth=3,t.lineJoin=`round`,t.strokeStyle=e.toCss(h.background,.9),t.fillStyle=e.toCss(h.text,.85);for(let{label:e,box:n}of i.pointLabels){let r=n.y+n.height/2;if(e.color){t.save(),t.fillStyle=e.color,t.fillText(e.text,n.x,r),t.restore();continue}t.strokeText(e.text,n.x,r),t.fillText(e.text,n.x,r)}t.restore()}let w=i.hover;if(w){if(w.crosshairX!==null){t.save(),t.strokeStyle=e.toCss(h.textMuted,.55),t.lineWidth=1,t.setLineDash([3,3]),t.beginPath();let n=Math.round(w.crosshairX)+.5;t.moveTo(n,y.y),t.lineTo(n,y.y+y.height),t.stroke(),t.restore()}if(w.crosshairY!==null){t.save(),t.strokeStyle=e.toCss(h.textMuted,.55),t.lineWidth=1,t.setLineDash([3,3]),t.beginPath();let n=Math.round(w.crosshairY)+.5;t.moveTo(y.x,n),t.lineTo(y.x+y.width,n),t.stroke(),t.restore()}for(let n of w.marks)if(n.kind!==`band`&&n.kind!==`guide`){if(n.kind===`cell`){let e=Math.min(3,n.width*.06,n.height*.06),r=Math.max(2,n.radius);t.save(),t.shadowColor=`rgba(15, 23, 42, 0.4)`,t.shadowBlur=12,t.shadowOffsetY=4,s(t,n.x-e,n.y-e,n.width+e*2,n.height+e*2,r),t.fillStyle=n.color,t.fill(),t.restore();let i=Math.min(2.75,n.width/5,n.height/5);n.width>8&&n.height>8&&(s(t,n.x+i,n.y+i,n.width-i*2,n.height-i*2,Math.max(1,r-i/2)),t.lineWidth=1.5,t.strokeStyle=n.ring,t.stroke());continue}t.beginPath(),t.arc(n.x,n.y,n.size/2+4,0,Math.PI*2),t.fillStyle=n.halo,t.fill(),t.beginPath(),t.arc(n.x,n.y,n.size/2-1,0,Math.PI*2),t.fillStyle=n.color,t.fill(),t.lineWidth=2,t.strokeStyle=e.toCss(h.background),t.stroke()}}if(i.dragging){let n=i.dragging;t.beginPath(),t.arc(n.x,n.y,n.size/2,0,Math.PI*2),t.fillStyle=n.color,t.globalAlpha=.85,t.fill(),t.globalAlpha=1,t.lineWidth=2,t.strokeStyle=e.toCss(h.background),t.stroke()}let T=w?.tooltip;if(T){let{box:r,lineHeight:i,padding:a}=T;t.save(),t.shadowColor=`rgba(15, 23, 42, 0.18)`,t.shadowBlur=16,t.shadowOffsetY=6,s(t,r.x,r.y,r.width,r.height,8),t.fillStyle=e.toCss(h.background),t.fill(),t.restore(),s(t,r.x+.5,r.y+.5,r.width-1,r.height-1,8),t.strokeStyle=e.toCss(h.axis,.6),t.lineWidth=1,t.stroke(),t.textBaseline=`middle`;let o=r.y+a+i/2,c=r.x+a+2,l=r.x+r.width-a-2;if(T.text){t.font=n.font(h,12),t.fillStyle=e.toCss(h.text),t.textAlign=`left`;for(let e of T.text)t.fillText(e,c,o),o+=i}else{let{content:r}=T,a=c;r.titleColor&&(t.fillStyle=r.titleColor,t.beginPath(),t.arc(a+4,o,4,0,Math.PI*2),t.fill(),a+=14),t.font=n.font(h,12,600),t.fillStyle=e.toCss(h.text),t.textAlign=`left`,t.fillText(r.title,a,o),o+=i,r.subtitle&&(t.font=n.font(h,11),t.fillStyle=e.toCss(h.textMuted),t.fillText(r.subtitle,a,o-2),o+=i);for(let s of r.rows)a=c,s.color&&(t.fillStyle=s.color,t.beginPath(),t.arc(a+4,o,4,0,Math.PI*2),t.fill()),a+=T.swatchWidth,t.font=n.font(h,12),t.textAlign=`left`,t.fillStyle=e.toCss(h.textMuted),t.fillText(s.name,a,o),t.font=n.font(h,12,600),t.textAlign=`right`,t.fillStyle=e.toCss(h.text),t.fillText(s.value,l,o),o+=i}}},d=e=>{let{canvas:n}=e,s=n.getContext(`2d`),c=e.width,l=e.height,d=e.pixelRatio??1,f=!1,p=null,m=[],h=null,g=``,_=``,v=e.options,y=new WeakMap,b=0,x=e=>{let t=y.get(e);return t===void 0&&y.set(e,t=++b),t},S={x:0,y:0},C=0,w=``,T=(e,t)=>s?(t!==w&&(s.font=t,w=t),s.measureText(e).width):e.length*6.5,E=s?r.createCanvas2dPainter(s):null,D=globalThis,O=()=>{if(p=null,f||!s||!E)return;let e=A.getScene();if(!e)return;let r=Math.max(1,Math.round(c*d)),a=Math.max(1,Math.round(l*d));n.width!==r&&(n.width=r),n.height!==a&&(n.height=a),w=``,h!==e.model&&(h=e.model,g=i.itemsSignature(e.model,x(e.theme),e=>v.series[e]?.stack));let y=e.layout.scales,b={x:1/Math.abs(y.xPerPx),y:1/Math.abs(y.yPerPx)},T=`${g}|${t.cellStyleKey(e.model,b)}`;T!==_&&(_=T,S={x:o(e.model.base.x),y:o(e.model.base.y)},m=t.buildItems(e.model,S,++C,b)),u(s,e,m,S,d,E),w=``},k=()=>{f||p!==null||(p=n.requestAnimationFrame?n.requestAnimationFrame(O):D.requestAnimationFrame?D.requestAnimationFrame(O):setTimeout(O,16))},A=a.createChartController({options:e.options,theme:e.theme,measureText:T,onInvalidate:k});A.setSize(c,l);let j=(e,t)=>({id:e.identifier??t,touch:!0});return{setOptions:e=>{v=e,A.setOptions(e)},setTheme:e=>A.setTheme(e),resize(e,t,n){c=e,l=t,n&&(d=n),A.setSize(e,t),k()},render(){p!==null&&(n.cancelAnimationFrame?n.cancelAnimationFrame(p):D.cancelAnimationFrame?D.cancelAnimationFrame(p):clearTimeout(p)),O()},touchStart(e){e.forEach((e,t)=>A.pointerDown(e.x,e.y,j(e,t)))},touchMove(e){e.forEach((e,t)=>A.pointerMove(e.x,e.y,j(e,t)))},touchEnd(e){e.forEach((e,t)=>A.pointerUp(e.x,e.y,j(e,t)))},touchCancel(e=[{x:0,y:0}]){e.forEach((e,t)=>A.pointerCancel(j(e,t)))},pointerDown:(e,t,n)=>A.pointerDown(e,t,n),pointerMove:(e,t,n)=>A.pointerMove(e,t,n),pointerUp:(e,t,n)=>A.pointerUp(e,t,n),pointerLeave:()=>A.pointerLeave(),zoomAt:(e,t,n)=>A.zoomAt(e,t,n),resetZoom:()=>A.resetZoom(),getView:()=>A.getView(),setView:e=>A.setView(e),toggleSeries:e=>A.toggleSeries(e),clearHover:()=>A.clearHover(),getPlotRect:()=>A.getPlotRect(),toPixel:(e,t)=>A.toPixel(e,t),fromPixel:(e,t)=>A.fromPixel(e,t),getController:()=>A,on:(e,t)=>A.on(e,t),destroy(){f||(f=!0,p!==null&&(n.cancelAnimationFrame?n.cancelAnimationFrame(p):D.cancelAnimationFrame?D.cancelAnimationFrame(p):clearTimeout(p)),E?.destroy(),A.destroy())}}};exports.createCanvasChart=d,exports.drawPrimitives=c,exports.drawScene=u;
|
|
1
|
+
const e=require("./tooltip.cjs"),t=require("./color.cjs"),n=require("./overlay.cjs"),r=require("./scene.cjs"),i=require("./items.cjs"),a=require("./renderers/canvas2d.cjs"),o=require("./signature.cjs"),s=require("./controller.cjs");var c=e=>(e[0]+e[1])/2,l=(e,t,n,r,i,a)=>{e.beginPath(),e.moveTo(t+a,n),e.lineTo(t+r-a,n),e.arcTo(t+r,n,t+r,n+a,a),e.lineTo(t+r,n+i-a),e.arcTo(t+r,n+i,t+r-a,n+i,a),e.lineTo(t+a,n+i),e.arcTo(t,n+i,t,n+i-a,a),e.lineTo(t,n+a),e.arcTo(t,n,t+a,n,a),e.closePath()},u=(e,t,n)=>{e.save(),e.beginPath(),e.rect(n.x,n.y,n.width,n.height),e.clip(),e.lineJoin=`round`,e.lineCap=`round`;for(let n of t)if(n.kind===`area`)e.globalAlpha=n.opacity,e.fillStyle=n.color,n.segments.forEach((t,r)=>{let i=n.bottoms?.[r],a=t.length/2;if(!(a<2)){e.beginPath();for(let n=0;n<a;n++)n===0?e.moveTo(t[0],t[1]):e.lineTo(t[n*2],t[n*2+1]);for(let r=a-1;r>=0;r--){let a=i?i[r]:n.baseline;n.horizontal?e.lineTo(a,t[r*2+1]):e.lineTo(t[r*2],a)}e.closePath(),e.fill()}}),e.globalAlpha=1;else if(n.kind===`line`){e.strokeStyle=n.color,e.lineWidth=n.width,e.beginPath();for(let t of n.segments)for(let n=0;n<t.length;n+=2)n===0?e.moveTo(t[0],t[1]):e.lineTo(t[n],t[n+1]);e.stroke()}else if(n.kind===`bars`){e.globalAlpha=n.opacity??1;let t=n.radius??0;for(let r=0;r<n.rects.length;r+=4){let[i,a,o,s]=[n.rects[r],n.rects[r+1],n.rects[r+2],n.rects[r+3]];e.fillStyle=n.colors?.[r/4]??n.color;let c=Math.min(t,o/2,s/2);c>.5?(l(e,i,a,o,s,c),e.fill()):e.fillRect(i,a,o,s)}e.globalAlpha=1}else{let t=n.stroke??0;for(let r=0;r<n.dots.length;r+=3){let i=n.colors[r/3]??`#888`,a=n.dots[r+2]/2;e.beginPath(),e.arc(n.dots[r],n.dots[r+1],Math.max(0,a-t/2),0,Math.PI*2),n.opacity>0&&(e.globalAlpha=n.opacity,e.fillStyle=i,e.fill()),t>0&&(e.globalAlpha=1,e.lineWidth=t,e.strokeStyle=i,e.stroke())}e.globalAlpha=1}e.restore()},d=(e,r,i)=>{let{theme:a}=i,{bar:o,stops:s}=r,c=s.length;if(typeof e.createLinearGradient==`function`){let t=e.createLinearGradient(o.x,0,o.x+o.width,0);s.forEach((e,n)=>t.addColorStop(n/Math.max(1,c-1),e)),e.fillStyle=t,l(e,o.x,o.y,o.width,o.height,o.height/2),e.fill()}else{let t=o.width/c;s.forEach((n,r)=>{e.fillStyle=n,e.fillRect(o.x+r*t,o.y,t+.5,o.height)})}e.fillStyle=t.toCss(a.text,.35);for(let t of r.ticks)e.fillRect(Math.round(t),o.y-2,1,o.height+4);e.font=n.font(a,11),e.textBaseline=`middle`,e.fillStyle=t.toCss(a.textMuted);for(let t of r.labels)e.textAlign=t.align,e.fillText(t.text,t.x,t.y);r.caret!==null&&(l(e,r.caret-2,o.y-3,4,o.height+6,2),e.fillStyle=t.toCss(a.text),e.fill(),e.lineWidth=1.5,e.strokeStyle=t.toCss(a.background),e.stroke())},f=1.16,p=(e,t,n,r)=>{let i=Math.max(0,t.width+r*2),a=Math.max(0,t.height+r*2);l(e,t.x-r,t.y-r,i,a,Math.max(0,Math.min(n+r,i/2,a/2)))},m=(e,n,r,i,a,o,s,c,l)=>{let u=t.toCss(l.background);o?(e.save(),e.shadowColor=`rgba(15, 23, 42, 0.4)`,e.shadowBlur=14,e.shadowOffsetY=5,p(e,n,r,s+(c?.width??0)),e.fillStyle=c?c.color:u,e.fill(),e.restore(),c&&(p(e,n,r,s),e.fillStyle=u,e.fill())):a&&(p(e,n,r,0),e.fillStyle=u,e.fill()),p(e,n,r,0),e.fillStyle=i,e.fill(),o&&o.width>0&&(p(e,n,r,-o.width/2),e.lineWidth=o.width,e.strokeStyle=o.color,e.stroke())},h=(e,n,i,a)=>{for(let o of n)if(o.kind===`bar`){let t=r.liftedBarRect(o);e.save(),e.beginPath(),e.rect(i.x,i.y,i.width,i.height),e.clip();let n=o.ring===null?null:{color:o.ring,width:Math.min(o.backdrop?2:1.5,Math.max(0,(Math.min(t.width,t.height)-2)/4))};m(e,t,o.radius,o.color,o.backdrop,n,1.5,null,a),e.restore()}else if(o.kind===`cell`){let n=o.width*f,r=o.height*f;m(e,{x:o.x+(o.width-n)/2,y:o.y+(o.height-r)/2,width:n,height:r},Math.max(2,o.radius)*f,o.color,!1,{color:o.ring,width:Math.min(2,Math.min(n,r)/5)},2,{color:t.toCss(a.primary,.6),width:1.5},a)}},g=(r,i,o,c,f,p=a.createCanvas2dPainter(r))=>{let{width:m,height:g,theme:_,model:v,view:y,layout:b}=i,{plot:x,scales:S}=b,C=f;r.setTransform(1,0,0,1,0,0),r.clearRect(0,0,Math.ceil(m*C),Math.ceil(g*C)),r.setTransform(C,0,0,C,0,0),n.drawBackground(r,{width:m,height:g,scales:S,x:v.x,y:v.y,xTicks:b.xTicks,yTicks:b.yTicks,y2:v.y2,y2Ticks:b.y2Ticks,theme:_,annotations:i.annotations});let w=i.legend?.colors;if(w&&d(r,w,i),i.legend){r.font=n.font(_,12),r.textBaseline=`middle`,r.textAlign=`left`;for(let e of i.legend.entries){let n=e.box.y+e.box.height/2;if(r.globalAlpha=e.hidden?.45:1,r.fillStyle=e.color,e.shape===`dot`?(r.beginPath(),r.arc(e.box.x+5,n,4,0,Math.PI*2),r.fill()):e.shape===`line`?r.fillRect(e.box.x,n-1,10,2):r.fillRect(e.box.x+1,n-4,8,8),r.fillStyle=t.toCss(_.textMuted),r.fillText(e.name,e.box.x+14,n),e.hidden){let t=e.box.width-22;r.fillRect(e.box.x+14,n,t,1)}}r.globalAlpha=1}let T=i.hover?.marks.some(e=>e.kind===`bar`)??!1;for(let e of i.hover?.marks??[])e.kind===`band`&&(l(r,e.x,e.y,e.width,e.height,6),r.fillStyle=t.toCss(_.text,T?.04:.06),r.fill());S.horizontal?u(r,s.scenePrimitives(i),x):E();function E(){let e=(e,t,n)=>{let r=2/(e[1]-e[0]),i=(t-e[0])*r-1;return n?[-r,-i]:[r,i]},[t,n]=e(y.x,c.x,v.x.reverse),[r,i]=e(y.y,c.y,v.y.reverse);p.paint(o,{transform:{xScale:t,xOffset:n,yScale:r,yOffset:i},width:Math.max(1,Math.round(x.width*C)),height:Math.max(1,Math.round(x.height*C)),dpr:C},Math.round(x.x*C),Math.round(x.y*C))}r.setTransform(C,0,0,C,0,0);for(let e of i.hover?.marks??[])e.kind===`guide`&&(r.fillStyle=t.toCss(_.text,.06),r.fillRect(e.x,e.y,e.width,e.height));if(T&&(r.fillStyle=t.toCss(_.background,.42),r.fillRect(x.x,x.y,x.width,x.height)),i.hover&&h(r,i.hover.marks,x,_),n.drawForeground(r,{width:m,height:g,scales:S,theme:_,annotations:i.annotations,pointLabels:[],clear:!1,connectors:i.connectors,arrows:i.arrows}),i.pointLabels.length){r.save(),r.font=n.font(_),r.textAlign=`left`,r.textBaseline=`middle`,r.lineWidth=3,r.lineJoin=`round`,r.strokeStyle=t.toCss(_.background,.9),r.fillStyle=t.toCss(_.text,.85);for(let{label:e,box:t}of i.pointLabels){let n=t.y+t.height/2;if(e.color){r.save(),r.fillStyle=e.color,r.fillText(e.text,t.x,n),r.restore();continue}r.strokeText(e.text,t.x,n),r.fillText(e.text,t.x,n)}r.restore()}let D=i.hover;if(D){if(D.crosshairX!==null){r.save(),r.strokeStyle=t.toCss(_.textMuted,.55),r.lineWidth=1,r.setLineDash([3,3]),r.beginPath();let e=Math.round(D.crosshairX)+.5;r.moveTo(e,x.y),r.lineTo(e,x.y+x.height),r.stroke(),r.restore()}if(D.crosshairY!==null){r.save(),r.strokeStyle=t.toCss(_.textMuted,.55),r.lineWidth=1,r.setLineDash([3,3]),r.beginPath();let e=Math.round(D.crosshairY)+.5;r.moveTo(x.x,e),r.lineTo(x.x+x.width,e),r.stroke(),r.restore()}for(let e of D.marks)e.kind!==`band`&&e.kind!==`guide`&&e.kind!==`bar`&&e.kind!==`cell`&&(r.beginPath(),r.arc(e.x,e.y,e.size/2+4,0,Math.PI*2),r.fillStyle=e.halo,r.fill(),r.beginPath(),r.arc(e.x,e.y,e.size/2-1,0,Math.PI*2),r.fillStyle=e.color,r.fill(),r.lineWidth=2,r.strokeStyle=t.toCss(_.background),r.stroke())}if(i.dragging){let e=i.dragging;r.beginPath(),r.arc(e.x,e.y,e.size/2,0,Math.PI*2),r.fillStyle=e.color,r.globalAlpha=.85,r.fill(),r.globalAlpha=1,r.lineWidth=2,r.strokeStyle=t.toCss(_.background),r.stroke()}let O=D?.tooltip;if(O){let{box:i,lineHeight:a,padding:o}=O;r.save(),r.shadowColor=`rgba(15, 23, 42, 0.18)`,r.shadowBlur=16,r.shadowOffsetY=6,l(r,i.x,i.y,i.width,i.height,8),r.fillStyle=t.toCss(_.background,e.CANVAS_TOOLTIP_ALPHA),r.fill(),r.restore(),l(r,i.x+.5,i.y+.5,i.width-1,i.height-1,8),r.strokeStyle=t.toCss(_.axis,.6),r.lineWidth=1,r.stroke(),r.textBaseline=`middle`;let s=i.y+o+a/2,c=i.x+o+2,u=i.x+i.width-o-2;if(O.text){r.font=n.font(_,12),r.fillStyle=t.toCss(_.text),r.textAlign=`left`;for(let e of O.text)r.fillText(e,c,s),s+=a}else{let{content:e}=O,i=c;e.titleColor&&(r.fillStyle=e.titleColor,r.beginPath(),r.arc(i+4,s,4,0,Math.PI*2),r.fill(),i+=14),r.font=n.font(_,12,600),r.fillStyle=t.toCss(_.text),r.textAlign=`left`,r.fillText(e.title,i,s),s+=a,e.subtitle&&(r.font=n.font(_,11),r.fillStyle=t.toCss(_.textMuted),r.fillText(e.subtitle,i,s-2),s+=a);for(let o of e.rows)i=c,o.color&&(r.fillStyle=o.color,r.beginPath(),r.arc(i+4,s,4,0,Math.PI*2),r.fill()),i+=O.swatchWidth,r.font=n.font(_,12),r.textAlign=`left`,r.fillStyle=t.toCss(_.textMuted),r.fillText(o.name,i,s),r.font=n.font(_,12,600),r.textAlign=`right`,r.fillStyle=t.toCss(_.text),r.fillText(o.value,u,s),s+=a}}},_=e=>{let{canvas:t}=e,n=t.getContext(`2d`),r=e.width,l=e.height,u=e.pixelRatio??1,d=!1,f=null,p=[],m=null,h=``,_=``,v=e.options,y=new WeakMap,b=0,x=e=>{let t=y.get(e);return t===void 0&&y.set(e,t=++b),t},S={x:0,y:0},C=0,w=``,T=(e,t)=>n?(t!==w&&(n.font=t,w=t),n.measureText(e).width):e.length*6.5,E=n?a.createCanvas2dPainter(n):null,D=globalThis,O=()=>{if(f=null,d||!n||!E)return;let e=A.getScene();if(!e)return;let a=Math.max(1,Math.round(r*u)),s=Math.max(1,Math.round(l*u));t.width!==a&&(t.width=a),t.height!==s&&(t.height=s),w=``,m!==e.model&&(m=e.model,h=o.itemsSignature(e.model,x(e.theme),e=>v.series[e]?.stack));let y=e.layout.scales,b={x:1/Math.abs(y.xPerPx),y:1/Math.abs(y.yPerPx)},T=`${h}|${i.cellStyleKey(e.model,b)}`;T!==_&&(_=T,S={x:c(e.model.base.x),y:c(e.model.base.y)},p=i.buildItems(e.model,S,++C,b)),g(n,e,p,S,u,E),w=``},k=()=>{d||f!==null||(f=t.requestAnimationFrame?t.requestAnimationFrame(O):D.requestAnimationFrame?D.requestAnimationFrame(O):setTimeout(O,16))},A=s.createChartController({options:e.options,theme:e.theme,measureText:T,onInvalidate:k});A.setSize(r,l);let j=(e,t)=>({id:e.identifier??t,touch:!0});return{setOptions:e=>{v=e,A.setOptions(e)},setTheme:e=>A.setTheme(e),resize(e,t,n){r=e,l=t,n&&(u=n),A.setSize(e,t),k()},render(){f!==null&&(t.cancelAnimationFrame?t.cancelAnimationFrame(f):D.cancelAnimationFrame?D.cancelAnimationFrame(f):clearTimeout(f)),O()},touchStart(e){e.forEach((e,t)=>A.pointerDown(e.x,e.y,j(e,t)))},touchMove(e){e.forEach((e,t)=>A.pointerMove(e.x,e.y,j(e,t)))},touchEnd(e){e.forEach((e,t)=>A.pointerUp(e.x,e.y,j(e,t)))},touchCancel(e=[{x:0,y:0}]){e.forEach((e,t)=>A.pointerCancel(j(e,t)))},pointerDown:(e,t,n)=>A.pointerDown(e,t,n),pointerMove:(e,t,n)=>A.pointerMove(e,t,n),pointerUp:(e,t,n)=>A.pointerUp(e,t,n),pointerLeave:()=>A.pointerLeave(),zoomAt:(e,t,n)=>A.zoomAt(e,t,n),resetZoom:()=>A.resetZoom(),getView:()=>A.getView(),setView:e=>A.setView(e),toggleSeries:e=>A.toggleSeries(e),clearHover:()=>A.clearHover(),getPlotRect:()=>A.getPlotRect(),toPixel:(e,t)=>A.toPixel(e,t),fromPixel:(e,t)=>A.fromPixel(e,t),getController:()=>A,on:(e,t)=>A.on(e,t),destroy(){d||(d=!0,f!==null&&(t.cancelAnimationFrame?t.cancelAnimationFrame(f):D.cancelAnimationFrame?D.cancelAnimationFrame(f):clearTimeout(f)),E?.destroy(),A.destroy())}}};exports.createCanvasChart=_,exports.drawPrimitives=u,exports.drawScene=g;
|
|
2
2
|
//# sourceMappingURL=canvas.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canvas.cjs","names":["toCss","font","createCanvas2dPainter","scenePrimitives","itemsSignature","cellStyleKey","buildItems","createChartController","require_color","require_items","require_overlay","require_canvas2d","require_signature","require_controller","mid","r","roundedRect","ctx","x","y","w","h","drawPrimitives","plot","p","primitives","bottoms","k","n","run","i","b","radius","stroke","color","drawColorLegend","scene","ramp","stops","gradient","bar","c","theme","t","l","drawScene","layout","dpr","pixelRatio","width","height","model","e","cy","mark","scales","paintData","scale","s","range","offset","o","reverse","xScale","xOffset","view","origin","yScale","yOffset","painter","items","box","label","hover","cx","grow","inset","d","tip","padding","lineHeight","left","right","line","content","row","createCanvasChart","config","canvas","destroyed","frameId","itemsModel","itemsKey0","itemsKey","options","themeIds","themeCount","themeId","id","version","fontSet","measureText","f","text","g","render","controller","pw","ph","index","sc","density","key","schedule","touchOptions","ratio","touches","v","type","listener"],"sources":["../../../../charts/src/engine/canvas.ts"],"sourcesContent":["// createCanvasChart: a whole chart drawn on one 2D canvas without any DOM:\n// WeChat / Alipay / ByteDance mini-programs (`<canvas type=\"2d\">`), Taro,\n// uni-app, OffscreenCanvas, or a plain browser canvas. The host forwards\n// touches / pointer events; everything else is handled here.\n\nimport { toCss } from \"./color\";\nimport {\n createChartController,\n scenePrimitives,\n type ChartController,\n type ChartControllerEventMap,\n type ChartPointerOptions,\n type ChartPrimitive,\n type ChartScene,\n} from \"./controller\";\nimport { buildItems, cellStyleKey, type Origin } from \"./items\";\nimport { drawBackground, drawForeground, font } from \"./overlay\";\nimport { createCanvas2dPainter } from \"./renderers/canvas2d\";\nimport type { RenderItem } from \"./renderers/types\";\nimport { itemsSignature } from \"./signature\";\nimport type { ChartThemeInput } from \"./theme\";\nimport type { ChartOptions, ChartRect, ChartView } from \"./types\";\n\n/**\n * The canvas a chart draws on: a browser `HTMLCanvasElement`, an\n * `OffscreenCanvas` or the node of a mini-program `<canvas type=\"2d\">`\n * (`SelectorQuery.fields({ node: true })`)\n */\nexport interface ChartCanvas {\n width: number;\n height: number;\n getContext(type: \"2d\"): unknown;\n /** Mini-program canvases schedule their frames themselves */\n requestAnimationFrame?: (callback: () => void) => number;\n cancelAnimationFrame?: (id: number) => void;\n}\n\n/** A touch point relative to the canvas (`x` / `y`) with its identifier */\nexport interface ChartTouch {\n x: number;\n y: number;\n identifier?: number;\n}\n\nexport interface CanvasChartConfig {\n canvas: ChartCanvas;\n /** Size of the canvas in CSS pixels (rpx converted by the host) */\n width: number;\n height: number;\n /**\n * Device pixel ratio (`wx.getWindowInfo().pixelRatio` in mini-programs)\n * @default 1\n */\n pixelRatio?: number;\n options: ChartOptions;\n /** Colors and fonts: values of the Minerva CSS variables */\n theme?: ChartThemeInput;\n}\n\nexport interface CanvasChartInstance {\n setOptions(options: ChartOptions): void;\n setTheme(theme: ChartThemeInput | undefined): void;\n /** New CSS size (and pixel ratio) of the canvas */\n resize(width: number, height: number, pixelRatio?: number): void;\n /** Draws now (frames are otherwise scheduled automatically) */\n render(): void;\n /** Touch handlers: pass the `touches` / `changedTouches` of the event */\n touchStart(touches: readonly ChartTouch[]): void;\n touchMove(touches: readonly ChartTouch[]): void;\n touchEnd(changedTouches: readonly ChartTouch[]): void;\n touchCancel(changedTouches?: readonly ChartTouch[]): void;\n /** Mouse / pen handlers (H5, desktop mini-programs) */\n pointerDown(x: number, y: number, options?: ChartPointerOptions): void;\n pointerMove(x: number, y: number, options?: ChartPointerOptions): void;\n pointerUp(x: number, y: number, options?: ChartPointerOptions): void;\n pointerLeave(): void;\n /** Zooms around a pixel (factor < 1 zooms in) */\n zoomAt(x: number, y: number, factor: number): void;\n resetZoom(): void;\n getView(): ChartView;\n setView(view: Partial<ChartView>): void;\n toggleSeries(id: string): void;\n clearHover(): void;\n getPlotRect(): ChartRect | null;\n toPixel(x: number, y: number): { x: number; y: number } | null;\n fromPixel(x: number, y: number): { x: number; y: number } | null;\n /** The platform-free controller (scene, gestures) */\n getController(): ChartController;\n on<K extends keyof ChartControllerEventMap>(\n type: K,\n listener: (event: ChartControllerEventMap[K]) => void,\n ): () => void;\n destroy(): void;\n}\n\nconst mid = (r: [number, number]) => (r[0] + r[1]) / 2;\n\nconst roundedRect = (\n ctx: CanvasRenderingContext2D,\n x: number,\n y: number,\n w: number,\n h: number,\n r: number,\n) => {\n ctx.beginPath();\n ctx.moveTo(x + r, y);\n ctx.lineTo(x + w - r, y);\n ctx.arcTo(x + w, y, x + w, y + r, r);\n ctx.lineTo(x + w, y + h - r);\n ctx.arcTo(x + w, y + h, x + w - r, y + h, r);\n ctx.lineTo(x + r, y + h);\n ctx.arcTo(x, y + h, x, y + h - r, r);\n ctx.lineTo(x, y + r);\n ctx.arcTo(x, y, x + r, y, r);\n ctx.closePath();\n};\n\n/**\n * Draws the shapes of `scenePrimitives` (CSS pixels of the chart) clipped to\n * the plot: the data of horizontal charts\n */\nexport const drawPrimitives = (\n ctx: CanvasRenderingContext2D,\n primitives: readonly ChartPrimitive[],\n plot: { x: number; y: number; width: number; height: number },\n) => {\n ctx.save();\n ctx.beginPath();\n ctx.rect(plot.x, plot.y, plot.width, plot.height);\n ctx.clip();\n ctx.lineJoin = \"round\";\n ctx.lineCap = \"round\";\n for (const p of primitives) {\n if (p.kind === \"area\") {\n ctx.globalAlpha = p.opacity;\n ctx.fillStyle = p.color;\n p.segments.forEach((run, k) => {\n const bottoms = p.bottoms?.[k];\n const n = run.length / 2;\n if (n < 2) return;\n ctx.beginPath();\n for (let i = 0; i < n; i++) {\n if (i === 0) ctx.moveTo(run[0], run[1]);\n else ctx.lineTo(run[i * 2], run[i * 2 + 1]);\n }\n // back along the bottom edge (or the baseline)\n for (let i = n - 1; i >= 0; i--) {\n const b = bottoms ? bottoms[i] : p.baseline;\n if (p.horizontal) ctx.lineTo(b, run[i * 2 + 1]);\n else ctx.lineTo(run[i * 2], b);\n }\n ctx.closePath();\n ctx.fill();\n });\n ctx.globalAlpha = 1;\n } else if (p.kind === \"line\") {\n ctx.strokeStyle = p.color;\n ctx.lineWidth = p.width;\n ctx.beginPath();\n for (const run of p.segments) {\n for (let i = 0; i < run.length; i += 2) {\n if (i === 0) ctx.moveTo(run[0], run[1]);\n else ctx.lineTo(run[i], run[i + 1]);\n }\n }\n ctx.stroke();\n } else if (p.kind === \"bars\") {\n ctx.globalAlpha = p.opacity ?? 1;\n const r = p.radius ?? 0;\n for (let k = 0; k < p.rects.length; k += 4) {\n const [x, y, w, h] = [\n p.rects[k],\n p.rects[k + 1],\n p.rects[k + 2],\n p.rects[k + 3],\n ];\n ctx.fillStyle = p.colors?.[k / 4] ?? p.color;\n const radius = Math.min(r, w / 2, h / 2);\n if (radius > 0.5) {\n roundedRect(ctx, x, y, w, h, radius);\n ctx.fill();\n } else {\n ctx.fillRect(x, y, w, h);\n }\n }\n ctx.globalAlpha = 1;\n } else {\n const stroke = p.stroke ?? 0;\n for (let k = 0; k < p.dots.length; k += 3) {\n const color = p.colors[k / 3] ?? \"#888\";\n const r = p.dots[k + 2] / 2;\n ctx.beginPath();\n ctx.arc(\n p.dots[k],\n p.dots[k + 1],\n Math.max(0, r - stroke / 2),\n 0,\n Math.PI * 2,\n );\n if (p.opacity > 0) {\n ctx.globalAlpha = p.opacity;\n ctx.fillStyle = color;\n ctx.fill();\n }\n if (stroke > 0) {\n // rings stay opaque (hollow box plot outliers)\n ctx.globalAlpha = 1;\n ctx.lineWidth = stroke;\n ctx.strokeStyle = color;\n ctx.stroke();\n }\n }\n ctx.globalAlpha = 1;\n }\n }\n ctx.restore();\n};\n\n/** The visual map of a heatmap: gradient bar, value labels, hover caret */\nconst drawColorLegend = (\n ctx: CanvasRenderingContext2D,\n ramp: NonNullable<NonNullable<ChartScene[\"legend\"]>[\"colors\"]>,\n scene: ChartScene,\n) => {\n const { theme } = scene;\n const { bar, stops } = ramp;\n const n = stops.length;\n if (typeof ctx.createLinearGradient === \"function\") {\n const gradient = ctx.createLinearGradient(bar.x, 0, bar.x + bar.width, 0);\n stops.forEach((c, k) => gradient.addColorStop(k / Math.max(1, n - 1), c));\n ctx.fillStyle = gradient;\n roundedRect(ctx, bar.x, bar.y, bar.width, bar.height, bar.height / 2);\n ctx.fill();\n } else {\n // contexts without gradients: even steps\n const w = bar.width / n;\n stops.forEach((c, k) => {\n ctx.fillStyle = c;\n ctx.fillRect(bar.x + k * w, bar.y, w + 0.5, bar.height);\n });\n }\n ctx.fillStyle = toCss(theme.text, 0.35);\n for (const t of ramp.ticks)\n ctx.fillRect(Math.round(t), bar.y - 2, 1, bar.height + 4);\n ctx.font = font(theme, 11);\n ctx.textBaseline = \"middle\";\n ctx.fillStyle = toCss(theme.textMuted);\n for (const l of ramp.labels) {\n ctx.textAlign = l.align;\n ctx.fillText(l.text, l.x, l.y);\n }\n if (ramp.caret !== null) {\n roundedRect(ctx, ramp.caret - 2, bar.y - 3, 4, bar.height + 6, 2);\n ctx.fillStyle = toCss(theme.text);\n ctx.fill();\n ctx.lineWidth = 1.5;\n ctx.strokeStyle = toCss(theme.background);\n ctx.stroke();\n }\n};\n\n/** Draws a scene (legend, axes, data, labels, hover) on a 2D context */\nexport const drawScene = (\n ctx: CanvasRenderingContext2D,\n scene: ChartScene,\n items: readonly RenderItem[],\n origin: Origin,\n pixelRatio: number,\n painter = createCanvas2dPainter(ctx),\n) => {\n const { width, height, theme, model, view, layout } = scene;\n const { plot, scales } = layout;\n const dpr = pixelRatio;\n ctx.setTransform(1, 0, 0, 1, 0, 0);\n ctx.clearRect(0, 0, Math.ceil(width * dpr), Math.ceil(height * dpr));\n ctx.setTransform(dpr, 0, 0, dpr, 0, 0);\n drawBackground(ctx, {\n width,\n height,\n scales,\n x: model.x,\n y: model.y,\n xTicks: layout.xTicks,\n yTicks: layout.yTicks,\n y2: model.y2,\n y2Ticks: layout.y2Ticks,\n theme,\n annotations: scene.annotations,\n });\n\n // color legend of heatmaps\n const ramp = scene.legend?.colors;\n if (ramp) drawColorLegend(ctx, ramp, scene);\n // legend\n if (scene.legend) {\n ctx.font = font(theme, 12);\n ctx.textBaseline = \"middle\";\n ctx.textAlign = \"left\";\n for (const e of scene.legend.entries) {\n const cy = e.box.y + e.box.height / 2;\n ctx.globalAlpha = e.hidden ? 0.45 : 1;\n ctx.fillStyle = e.color;\n if (e.shape === \"dot\") {\n ctx.beginPath();\n ctx.arc(e.box.x + 5, cy, 4, 0, Math.PI * 2);\n ctx.fill();\n } else if (e.shape === \"line\") {\n ctx.fillRect(e.box.x, cy - 1, 10, 2);\n } else {\n ctx.fillRect(e.box.x + 1, cy - 4, 8, 8);\n }\n ctx.fillStyle = toCss(theme.textMuted);\n ctx.fillText(e.name, e.box.x + 14, cy);\n if (e.hidden) {\n const w = e.box.width - 22;\n ctx.fillRect(e.box.x + 14, cy, w, 1);\n }\n }\n ctx.globalAlpha = 1;\n }\n\n // hover band of bars, below the data\n for (const mark of scene.hover?.marks ?? []) {\n if (mark.kind !== \"band\") continue;\n roundedRect(ctx, mark.x, mark.y, mark.width, mark.height, 6);\n ctx.fillStyle = toCss(theme.text, 0.06);\n ctx.fill();\n }\n\n // data (horizontal charts: as shapes, the painter draws vertical charts)\n if (scales.horizontal) {\n drawPrimitives(ctx, scenePrimitives(scene), plot);\n } else {\n paintData();\n }\n function paintData() {\n const scale = (range: [number, number], o: number, reverse: boolean) => {\n const s = 2 / (range[1] - range[0]);\n const offset = (o - range[0]) * s - 1;\n return reverse ? [-s, -offset] : [s, offset];\n };\n const [xScale, xOffset] = scale(view.x, origin.x, model.x.reverse);\n const [yScale, yOffset] = scale(view.y, origin.y, model.y.reverse);\n painter.paint(\n items,\n {\n transform: { xScale, xOffset, yScale, yOffset },\n width: Math.max(1, Math.round(plot.width * dpr)),\n height: Math.max(1, Math.round(plot.height * dpr)),\n dpr,\n },\n Math.round(plot.x * dpr),\n Math.round(plot.y * dpr),\n );\n }\n\n ctx.setTransform(dpr, 0, 0, dpr, 0, 0);\n // soft row / column of a hovered heatmap cell, over the data\n for (const mark of scene.hover?.marks ?? []) {\n if (mark.kind !== \"guide\") continue;\n ctx.fillStyle = toCss(theme.text, 0.06);\n ctx.fillRect(mark.x, mark.y, mark.width, mark.height);\n }\n drawForeground(ctx, {\n width,\n height,\n scales,\n theme,\n annotations: scene.annotations,\n pointLabels: [],\n clear: false,\n connectors: scene.connectors,\n arrows: scene.arrows,\n });\n // dot labels placed by the scene\n if (scene.pointLabels.length) {\n ctx.save();\n ctx.font = font(theme);\n ctx.textAlign = \"left\";\n ctx.textBaseline = \"middle\";\n ctx.lineWidth = 3;\n ctx.lineJoin = \"round\";\n ctx.strokeStyle = toCss(theme.background, 0.9);\n ctx.fillStyle = toCss(theme.text, 0.85);\n for (const { label, box } of scene.pointLabels) {\n const y = box.y + box.height / 2;\n if (label.color) {\n // inside a solid bar: its contrasting color, no halo\n ctx.save();\n ctx.fillStyle = label.color;\n ctx.fillText(label.text, box.x, y);\n ctx.restore();\n continue;\n }\n ctx.strokeText(label.text, box.x, y);\n ctx.fillText(label.text, box.x, y);\n }\n ctx.restore();\n }\n\n // hover\n const hover = scene.hover;\n if (hover) {\n if (hover.crosshairX !== null) {\n ctx.save();\n ctx.strokeStyle = toCss(theme.textMuted, 0.55);\n ctx.lineWidth = 1;\n ctx.setLineDash([3, 3]);\n ctx.beginPath();\n const cx = Math.round(hover.crosshairX) + 0.5;\n ctx.moveTo(cx, plot.y);\n ctx.lineTo(cx, plot.y + plot.height);\n ctx.stroke();\n ctx.restore();\n }\n if (hover.crosshairY !== null) {\n ctx.save();\n ctx.strokeStyle = toCss(theme.textMuted, 0.55);\n ctx.lineWidth = 1;\n ctx.setLineDash([3, 3]);\n ctx.beginPath();\n const cy = Math.round(hover.crosshairY) + 0.5;\n ctx.moveTo(plot.x, cy);\n ctx.lineTo(plot.x + plot.width, cy);\n ctx.stroke();\n ctx.restore();\n }\n for (const mark of hover.marks) {\n if (mark.kind === \"band\" || mark.kind === \"guide\") continue;\n if (mark.kind === \"cell\") {\n // lifted: a little larger, with a soft shadow and an inner ring\n const grow = Math.min(3, mark.width * 0.06, mark.height * 0.06);\n const r = Math.max(2, mark.radius);\n ctx.save();\n ctx.shadowColor = \"rgba(15, 23, 42, 0.4)\";\n ctx.shadowBlur = 12;\n ctx.shadowOffsetY = 4;\n roundedRect(\n ctx,\n mark.x - grow,\n mark.y - grow,\n mark.width + grow * 2,\n mark.height + grow * 2,\n r,\n );\n ctx.fillStyle = mark.color;\n ctx.fill();\n ctx.restore();\n const inset = Math.min(2.75, mark.width / 5, mark.height / 5);\n if (mark.width > 8 && mark.height > 8) {\n roundedRect(\n ctx,\n mark.x + inset,\n mark.y + inset,\n mark.width - inset * 2,\n mark.height - inset * 2,\n Math.max(1, r - inset / 2),\n );\n ctx.lineWidth = 1.5;\n ctx.strokeStyle = mark.ring;\n ctx.stroke();\n }\n continue;\n }\n ctx.beginPath();\n ctx.arc(mark.x, mark.y, mark.size / 2 + 4, 0, Math.PI * 2);\n ctx.fillStyle = mark.halo;\n ctx.fill();\n ctx.beginPath();\n ctx.arc(mark.x, mark.y, mark.size / 2 - 1, 0, Math.PI * 2);\n ctx.fillStyle = mark.color;\n ctx.fill();\n ctx.lineWidth = 2;\n ctx.strokeStyle = toCss(theme.background);\n ctx.stroke();\n }\n }\n if (scene.dragging) {\n const d = scene.dragging;\n ctx.beginPath();\n ctx.arc(d.x, d.y, d.size / 2, 0, Math.PI * 2);\n ctx.fillStyle = d.color;\n ctx.globalAlpha = 0.85;\n ctx.fill();\n ctx.globalAlpha = 1;\n ctx.lineWidth = 2;\n ctx.strokeStyle = toCss(theme.background);\n ctx.stroke();\n }\n const tip = hover?.tooltip;\n if (tip) {\n const { box, lineHeight, padding } = tip;\n ctx.save();\n ctx.shadowColor = \"rgba(15, 23, 42, 0.18)\";\n ctx.shadowBlur = 16;\n ctx.shadowOffsetY = 6;\n roundedRect(ctx, box.x, box.y, box.width, box.height, 8);\n ctx.fillStyle = toCss(theme.background);\n ctx.fill();\n ctx.restore();\n roundedRect(\n ctx,\n box.x + 0.5,\n box.y + 0.5,\n box.width - 1,\n box.height - 1,\n 8,\n );\n ctx.strokeStyle = toCss(theme.axis, 0.6);\n ctx.lineWidth = 1;\n ctx.stroke();\n ctx.textBaseline = \"middle\";\n let y = box.y + padding + lineHeight / 2;\n const left = box.x + padding + 2;\n const right = box.x + box.width - padding - 2;\n if (tip.text) {\n ctx.font = font(theme, 12);\n ctx.fillStyle = toCss(theme.text);\n ctx.textAlign = \"left\";\n for (const line of tip.text) {\n ctx.fillText(line, left, y);\n y += lineHeight;\n }\n } else {\n const { content } = tip;\n let x = left;\n if (content.titleColor) {\n ctx.fillStyle = content.titleColor;\n ctx.beginPath();\n ctx.arc(x + 4, y, 4, 0, Math.PI * 2);\n ctx.fill();\n x += 14;\n }\n ctx.font = font(theme, 12, 600);\n ctx.fillStyle = toCss(theme.text);\n ctx.textAlign = \"left\";\n ctx.fillText(content.title, x, y);\n y += lineHeight;\n if (content.subtitle) {\n ctx.font = font(theme, 11);\n ctx.fillStyle = toCss(theme.textMuted);\n ctx.fillText(content.subtitle, x, y - 2);\n y += lineHeight;\n }\n for (const row of content.rows) {\n x = left;\n if (row.color) {\n ctx.fillStyle = row.color;\n ctx.beginPath();\n ctx.arc(x + 4, y, 4, 0, Math.PI * 2);\n ctx.fill();\n }\n // names in one column, values right-aligned in another\n x += tip.swatchWidth;\n ctx.font = font(theme, 12);\n ctx.textAlign = \"left\";\n ctx.fillStyle = toCss(theme.textMuted);\n ctx.fillText(row.name, x, y);\n ctx.font = font(theme, 12, 600);\n ctx.textAlign = \"right\";\n ctx.fillStyle = toCss(theme.text);\n ctx.fillText(row.value, right, y);\n y += lineHeight;\n }\n }\n }\n};\n\n/**\n * Creates a chart drawn on a 2D canvas: line, area, bar and scatter series,\n * annotations, legend and tooltip, tap / drag / pinch gestures. Works\n * without a DOM (mini-programs); see `createChart` for the GPU version of\n * the web.\n */\nexport const createCanvasChart = (\n config: CanvasChartConfig,\n): CanvasChartInstance => {\n const { canvas } = config;\n const ctx = canvas.getContext(\"2d\") as CanvasRenderingContext2D | null;\n let width = config.width;\n let height = config.height;\n let dpr = config.pixelRatio ?? 1;\n let destroyed = false;\n let frameId: number | null = null;\n let items: RenderItem[] = [];\n let itemsModel: unknown = null;\n let itemsKey0 = \"\";\n let itemsKey = \"\";\n let options = config.options;\n /** Ids of the themes seen (the controller replaces its theme on changes) */\n const themeIds = new WeakMap<object, number>();\n let themeCount = 0;\n const themeId = (theme: object) => {\n let id = themeIds.get(theme);\n if (id === undefined) themeIds.set(theme, (id = ++themeCount));\n return id;\n };\n let origin: Origin = { x: 0, y: 0 };\n let version = 0;\n let fontSet = \"\";\n\n const measureText = (text: string, f: string) => {\n if (!ctx) return text.length * 6.5;\n if (f !== fontSet) {\n ctx.font = f;\n fontSet = f;\n }\n return ctx.measureText(text).width;\n };\n\n const painter = ctx ? createCanvas2dPainter(ctx) : null;\n\n const g = globalThis as {\n requestAnimationFrame?: (cb: () => void) => number;\n cancelAnimationFrame?: (id: number) => void;\n };\n\n const render = () => {\n frameId = null;\n if (destroyed || !ctx || !painter) return;\n const scene = controller.getScene();\n if (!scene) return;\n const pw = Math.max(1, Math.round(width * dpr));\n const ph = Math.max(1, Math.round(height * dpr));\n if (canvas.width !== pw) canvas.width = pw;\n if (canvas.height !== ph) canvas.height = ph;\n fontSet = \"\";\n if (itemsModel !== scene.model) {\n itemsModel = scene.model;\n // a new model (any setOptions) keeps the items when nothing they\n // depend on changed\n itemsKey0 = itemsSignature(\n scene.model,\n themeId(scene.theme),\n (index) => options.series[index]?.stack,\n );\n }\n // heatmap cells: their gaps and corners follow their size on screen\n const sc = scene.layout.scales;\n const density = { x: 1 / Math.abs(sc.xPerPx), y: 1 / Math.abs(sc.yPerPx) };\n const key = `${itemsKey0}|${cellStyleKey(scene.model, density)}`;\n if (key !== itemsKey) {\n itemsKey = key;\n origin = { x: mid(scene.model.base.x), y: mid(scene.model.base.y) };\n items = buildItems(scene.model, origin, ++version, density);\n }\n drawScene(ctx, scene, items, origin, dpr, painter);\n fontSet = \"\";\n };\n\n const schedule = () => {\n if (destroyed || frameId !== null) return;\n if (canvas.requestAnimationFrame)\n frameId = canvas.requestAnimationFrame(render);\n else if (g.requestAnimationFrame) frameId = g.requestAnimationFrame(render);\n else frameId = setTimeout(render, 16) as unknown as number;\n };\n\n const controller = createChartController({\n options: config.options,\n theme: config.theme,\n measureText,\n onInvalidate: schedule,\n });\n controller.setSize(width, height);\n\n const touchOptions = (t: ChartTouch, i: number): ChartPointerOptions => ({\n id: t.identifier ?? i,\n touch: true,\n });\n\n return {\n setOptions: (o) => {\n options = o;\n controller.setOptions(o);\n },\n setTheme: (t) => controller.setTheme(t),\n resize(w, h, ratio) {\n width = w;\n height = h;\n if (ratio) dpr = ratio;\n controller.setSize(w, h);\n schedule();\n },\n render() {\n if (frameId !== null) {\n if (canvas.cancelAnimationFrame) canvas.cancelAnimationFrame(frameId);\n else if (g.cancelAnimationFrame) g.cancelAnimationFrame(frameId);\n else clearTimeout(frameId);\n }\n render();\n },\n touchStart(touches) {\n touches.forEach((t, i) =>\n controller.pointerDown(t.x, t.y, touchOptions(t, i)),\n );\n },\n touchMove(touches) {\n touches.forEach((t, i) =>\n controller.pointerMove(t.x, t.y, touchOptions(t, i)),\n );\n },\n touchEnd(touches) {\n touches.forEach((t, i) =>\n controller.pointerUp(t.x, t.y, touchOptions(t, i)),\n );\n },\n touchCancel(touches = [{ x: 0, y: 0 }]) {\n touches.forEach((t, i) => controller.pointerCancel(touchOptions(t, i)));\n },\n pointerDown: (x, y, o) => controller.pointerDown(x, y, o),\n pointerMove: (x, y, o) => controller.pointerMove(x, y, o),\n pointerUp: (x, y, o) => controller.pointerUp(x, y, o),\n pointerLeave: () => controller.pointerLeave(),\n zoomAt: (x, y, f) => controller.zoomAt(x, y, f),\n resetZoom: () => controller.resetZoom(),\n getView: () => controller.getView(),\n setView: (v) => controller.setView(v),\n toggleSeries: (id) => controller.toggleSeries(id),\n clearHover: () => controller.clearHover(),\n getPlotRect: () => controller.getPlotRect(),\n toPixel: (x, y) => controller.toPixel(x, y),\n fromPixel: (x, y) => controller.fromPixel(x, y),\n getController: () => controller,\n on: (type, listener) => controller.on(type, listener),\n destroy() {\n if (destroyed) return;\n destroyed = true;\n if (frameId !== null) {\n if (canvas.cancelAnimationFrame) canvas.cancelAnimationFrame(frameId);\n else if (g.cancelAnimationFrame) g.cancelAnimationFrame(frameId);\n else clearTimeout(frameId);\n }\n painter?.destroy();\n controller.destroy();\n },\n };\n};\n"],"mappings":"oLA+FA,IAAMc,EAAO,IAAyBC,EAAE,GAAKA,EAAE,IAAM,EAE/CC,GACJ,EACA,EACA,EACA,EACA,EACA,IACG,CACHC,EAAI,UAAU,EACdA,EAAI,OAAOC,EAAIH,EAAGI,CAAC,EACnBF,EAAI,OAAOC,EAAIE,EAAIL,EAAGI,CAAC,EACvBF,EAAI,MAAMC,EAAIE,EAAGD,EAAGD,EAAIE,EAAGD,EAAIJ,EAAGA,CAAC,EACnCE,EAAI,OAAOC,EAAIE,EAAGD,EAAIE,EAAIN,CAAC,EAC3BE,EAAI,MAAMC,EAAIE,EAAGD,EAAIE,EAAGH,EAAIE,EAAIL,EAAGI,EAAIE,EAAGN,CAAC,EAC3CE,EAAI,OAAOC,EAAIH,EAAGI,EAAIE,CAAC,EACvBJ,EAAI,MAAMC,EAAGC,EAAIE,EAAGH,EAAGC,EAAIE,EAAIN,EAAGA,CAAC,EACnCE,EAAI,OAAOC,EAAGC,EAAIJ,CAAC,EACnBE,EAAI,MAAMC,EAAGC,EAAGD,EAAIH,EAAGI,EAAGJ,CAAC,EAC3BE,EAAI,UAAU,CAChB,EAMaK,GACX,EACA,EACA,IACG,CACHL,EAAI,KAAK,EACTA,EAAI,UAAU,EACdA,EAAI,KAAKM,EAAK,EAAGA,EAAK,EAAGA,EAAK,MAAOA,EAAK,MAAM,EAChDN,EAAI,KAAK,EACT,EAAI,SAAW,QACf,EAAI,QAAU,QACd,IAAK,IAAMO,KAAKC,EACd,GAAID,EAAE,OAAS,OACb,EAAI,YAAcA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CAAC,EACxD,WAAY,EAAG,EAAG,IAAM6C,EAAW,UAAUxF,EAAGC,EAAG0C,CAAC,EACpD,iBAAoB6C,EAAW,aAAa,EAC5C,QAAS,EAAG,EAAG,IAAMA,EAAW,OAAOxF,EAAGC,EAAGmF,CAAC,EAC9C,cAAiBI,EAAW,UAAU,EACtC,YAAeA,EAAW,QAAQ,EAClC,QAAU,GAAMA,EAAW,QAAQW,CAAC,EACpC,aAAe,GAAOX,EAAW,aAAaR,CAAE,EAChD,eAAkBQ,EAAW,WAAW,EACxC,gBAAmBA,EAAW,YAAY,EAC1C,SAAU,EAAG,IAAMA,EAAW,QAAQxF,EAAGC,CAAC,EAC1C,WAAY,EAAG,IAAMuF,EAAW,UAAUxF,EAAGC,CAAC,EAC9C,kBAAqBuF,EACrB,IAAK,EAAM,IAAaA,EAAW,GAAGY,EAAMC,CAAQ,EACpD,SAAU,CACJ9B,IACJ,EAAY,GACRC,IAAY,OACVF,EAAO,qBAAsBA,EAAO,qBAAqBE,CAAO,EAC3Dc,EAAE,qBAAsBA,EAAE,qBAAqBd,CAAO,EAC1D,aAAaA,CAAO,GAE3BrB,GAAS,QAAQ,EACjBqC,EAAW,QAAQ,EACrB,CACF,CACF"}
|
|
1
|
+
{"version":3,"file":"canvas.cjs","names":["toCss","font","liftedBarRect","createCanvas2dPainter","scenePrimitives","CANVAS_TOOLTIP_ALPHA","itemsSignature","cellStyleKey","buildItems","createChartController","require_tooltip","require_color","require_overlay","require_scene","require_items","require_canvas2d","require_signature","require_controller","mid","r","roundedRect","ctx","x","y","w","h","drawPrimitives","plot","p","primitives","bottoms","k","n","run","i","b","radius","stroke","color","drawColorLegend","scene","ramp","stops","gradient","bar","c","theme","l","CELL_LIFT","grownRect","d","drawLifted","background","ring","halo","accent","backdrop","fill","drawLiftedMarks","mark","marks","drawScene","layout","dpr","pixelRatio","width","height","model","cy","lifted","m","scales","paintData","scale","s","range","offset","o","reverse","xScale","xOffset","view","origin","yScale","yOffset","painter","items","box","label","hover","cx","tip","padding","lineHeight","left","right","line","content","row","createCanvasChart","config","canvas","destroyed","frameId","itemsModel","itemsKey0","itemsKey","options","themeIds","themeCount","themeId","id","version","fontSet","measureText","f","text","g","render","controller","pw","ph","index","sc","density","key","schedule","touchOptions","t","ratio","touches","v","type","listener"],"sources":["../../../../charts/src/engine/canvas.ts"],"sourcesContent":["// createCanvasChart: a whole chart drawn on one 2D canvas without any DOM:\n// WeChat / Alipay / ByteDance mini-programs (`<canvas type=\"2d\">`), Taro,\n// uni-app, OffscreenCanvas, or a plain browser canvas. The host forwards\n// touches / pointer events; everything else is handled here.\n\nimport { toCss } from \"./color\";\nimport {\n createChartController,\n scenePrimitives,\n type ChartController,\n type ChartControllerEventMap,\n type ChartPointerOptions,\n type ChartPrimitive,\n type ChartScene,\n} from \"./controller\";\nimport { buildItems, cellStyleKey, type Origin } from \"./items\";\nimport { drawBackground, drawForeground, font } from \"./overlay\";\nimport { createCanvas2dPainter } from \"./renderers/canvas2d\";\nimport type { RenderItem } from \"./renderers/types\";\nimport { liftedBarRect, type HoverMark } from \"./scene\";\nimport { itemsSignature } from \"./signature\";\nimport type { ChartThemeInput } from \"./theme\";\nimport { CANVAS_TOOLTIP_ALPHA } from \"./tooltip\";\nimport type { ChartOptions, ChartRect, ChartView } from \"./types\";\n\n/**\n * The canvas a chart draws on: a browser `HTMLCanvasElement`, an\n * `OffscreenCanvas` or the node of a mini-program `<canvas type=\"2d\">`\n * (`SelectorQuery.fields({ node: true })`)\n */\nexport interface ChartCanvas {\n width: number;\n height: number;\n getContext(type: \"2d\"): unknown;\n /** Mini-program canvases schedule their frames themselves */\n requestAnimationFrame?: (callback: () => void) => number;\n cancelAnimationFrame?: (id: number) => void;\n}\n\n/** A touch point relative to the canvas (`x` / `y`) with its identifier */\nexport interface ChartTouch {\n x: number;\n y: number;\n identifier?: number;\n}\n\nexport interface CanvasChartConfig {\n canvas: ChartCanvas;\n /** Size of the canvas in CSS pixels (rpx converted by the host) */\n width: number;\n height: number;\n /**\n * Device pixel ratio (`wx.getWindowInfo().pixelRatio` in mini-programs)\n * @default 1\n */\n pixelRatio?: number;\n options: ChartOptions;\n /** Colors and fonts: values of the Minerva CSS variables */\n theme?: ChartThemeInput;\n}\n\nexport interface CanvasChartInstance {\n setOptions(options: ChartOptions): void;\n setTheme(theme: ChartThemeInput | undefined): void;\n /** New CSS size (and pixel ratio) of the canvas */\n resize(width: number, height: number, pixelRatio?: number): void;\n /** Draws now (frames are otherwise scheduled automatically) */\n render(): void;\n /** Touch handlers: pass the `touches` / `changedTouches` of the event */\n touchStart(touches: readonly ChartTouch[]): void;\n touchMove(touches: readonly ChartTouch[]): void;\n touchEnd(changedTouches: readonly ChartTouch[]): void;\n touchCancel(changedTouches?: readonly ChartTouch[]): void;\n /** Mouse / pen handlers (H5, desktop mini-programs) */\n pointerDown(x: number, y: number, options?: ChartPointerOptions): void;\n pointerMove(x: number, y: number, options?: ChartPointerOptions): void;\n pointerUp(x: number, y: number, options?: ChartPointerOptions): void;\n pointerLeave(): void;\n /** Zooms around a pixel (factor < 1 zooms in) */\n zoomAt(x: number, y: number, factor: number): void;\n resetZoom(): void;\n getView(): ChartView;\n setView(view: Partial<ChartView>): void;\n toggleSeries(id: string): void;\n clearHover(): void;\n getPlotRect(): ChartRect | null;\n toPixel(x: number, y: number): { x: number; y: number } | null;\n fromPixel(x: number, y: number): { x: number; y: number } | null;\n /** The platform-free controller (scene, gestures) */\n getController(): ChartController;\n on<K extends keyof ChartControllerEventMap>(\n type: K,\n listener: (event: ChartControllerEventMap[K]) => void,\n ): () => void;\n destroy(): void;\n}\n\nconst mid = (r: [number, number]) => (r[0] + r[1]) / 2;\n\nconst roundedRect = (\n ctx: CanvasRenderingContext2D,\n x: number,\n y: number,\n w: number,\n h: number,\n r: number,\n) => {\n ctx.beginPath();\n ctx.moveTo(x + r, y);\n ctx.lineTo(x + w - r, y);\n ctx.arcTo(x + w, y, x + w, y + r, r);\n ctx.lineTo(x + w, y + h - r);\n ctx.arcTo(x + w, y + h, x + w - r, y + h, r);\n ctx.lineTo(x + r, y + h);\n ctx.arcTo(x, y + h, x, y + h - r, r);\n ctx.lineTo(x, y + r);\n ctx.arcTo(x, y, x + r, y, r);\n ctx.closePath();\n};\n\n/**\n * Draws the shapes of `scenePrimitives` (CSS pixels of the chart) clipped to\n * the plot: the data of horizontal charts\n */\nexport const drawPrimitives = (\n ctx: CanvasRenderingContext2D,\n primitives: readonly ChartPrimitive[],\n plot: { x: number; y: number; width: number; height: number },\n) => {\n ctx.save();\n ctx.beginPath();\n ctx.rect(plot.x, plot.y, plot.width, plot.height);\n ctx.clip();\n ctx.lineJoin = \"round\";\n ctx.lineCap = \"round\";\n for (const p of primitives) {\n if (p.kind === \"area\") {\n ctx.globalAlpha = p.opacity;\n ctx.fillStyle = p.color;\n p.segments.forEach((run, k) => {\n const bottoms = p.bottoms?.[k];\n const n = run.length / 2;\n if (n < 2) return;\n ctx.beginPath();\n for (let i = 0; i < n; i++) {\n if (i === 0) ctx.moveTo(run[0], run[1]);\n else ctx.lineTo(run[i * 2], run[i * 2 + 1]);\n }\n // back along the bottom edge (or the baseline)\n for (let i = n - 1; i >= 0; i--) {\n const b = bottoms ? bottoms[i] : p.baseline;\n if (p.horizontal) ctx.lineTo(b, run[i * 2 + 1]);\n else ctx.lineTo(run[i * 2], b);\n }\n ctx.closePath();\n ctx.fill();\n });\n ctx.globalAlpha = 1;\n } else if (p.kind === \"line\") {\n ctx.strokeStyle = p.color;\n ctx.lineWidth = p.width;\n ctx.beginPath();\n for (const run of p.segments) {\n for (let i = 0; i < run.length; i += 2) {\n if (i === 0) ctx.moveTo(run[0], run[1]);\n else ctx.lineTo(run[i], run[i + 1]);\n }\n }\n ctx.stroke();\n } else if (p.kind === \"bars\") {\n ctx.globalAlpha = p.opacity ?? 1;\n const r = p.radius ?? 0;\n for (let k = 0; k < p.rects.length; k += 4) {\n const [x, y, w, h] = [\n p.rects[k],\n p.rects[k + 1],\n p.rects[k + 2],\n p.rects[k + 3],\n ];\n ctx.fillStyle = p.colors?.[k / 4] ?? p.color;\n const radius = Math.min(r, w / 2, h / 2);\n if (radius > 0.5) {\n roundedRect(ctx, x, y, w, h, radius);\n ctx.fill();\n } else {\n ctx.fillRect(x, y, w, h);\n }\n }\n ctx.globalAlpha = 1;\n } else {\n const stroke = p.stroke ?? 0;\n for (let k = 0; k < p.dots.length; k += 3) {\n const color = p.colors[k / 3] ?? \"#888\";\n const r = p.dots[k + 2] / 2;\n ctx.beginPath();\n ctx.arc(\n p.dots[k],\n p.dots[k + 1],\n Math.max(0, r - stroke / 2),\n 0,\n Math.PI * 2,\n );\n if (p.opacity > 0) {\n ctx.globalAlpha = p.opacity;\n ctx.fillStyle = color;\n ctx.fill();\n }\n if (stroke > 0) {\n // rings stay opaque (hollow box plot outliers)\n ctx.globalAlpha = 1;\n ctx.lineWidth = stroke;\n ctx.strokeStyle = color;\n ctx.stroke();\n }\n }\n ctx.globalAlpha = 1;\n }\n }\n ctx.restore();\n};\n\n/** The visual map of a heatmap: gradient bar, value labels, hover caret */\nconst drawColorLegend = (\n ctx: CanvasRenderingContext2D,\n ramp: NonNullable<NonNullable<ChartScene[\"legend\"]>[\"colors\"]>,\n scene: ChartScene,\n) => {\n const { theme } = scene;\n const { bar, stops } = ramp;\n const n = stops.length;\n if (typeof ctx.createLinearGradient === \"function\") {\n const gradient = ctx.createLinearGradient(bar.x, 0, bar.x + bar.width, 0);\n stops.forEach((c, k) => gradient.addColorStop(k / Math.max(1, n - 1), c));\n ctx.fillStyle = gradient;\n roundedRect(ctx, bar.x, bar.y, bar.width, bar.height, bar.height / 2);\n ctx.fill();\n } else {\n // contexts without gradients: even steps\n const w = bar.width / n;\n stops.forEach((c, k) => {\n ctx.fillStyle = c;\n ctx.fillRect(bar.x + k * w, bar.y, w + 0.5, bar.height);\n });\n }\n ctx.fillStyle = toCss(theme.text, 0.35);\n for (const t of ramp.ticks)\n ctx.fillRect(Math.round(t), bar.y - 2, 1, bar.height + 4);\n ctx.font = font(theme, 11);\n ctx.textBaseline = \"middle\";\n ctx.fillStyle = toCss(theme.textMuted);\n for (const l of ramp.labels) {\n ctx.textAlign = l.align;\n ctx.fillText(l.text, l.x, l.y);\n }\n if (ramp.caret !== null) {\n roundedRect(ctx, ramp.caret - 2, bar.y - 3, 4, bar.height + 6, 2);\n ctx.fillStyle = toCss(theme.text);\n ctx.fill();\n ctx.lineWidth = 1.5;\n ctx.strokeStyle = toCss(theme.background);\n ctx.stroke();\n }\n};\n\n/** Scale of a hovered heatmap cell (like the DOM host) */\nconst CELL_LIFT = 1.16;\n\n/** A rounded rectangle grown by `d` on every side (shrunk when negative) */\nconst grownRect = (\n ctx: CanvasRenderingContext2D,\n r: { x: number; y: number; width: number; height: number },\n radius: number,\n d: number,\n) => {\n const w = Math.max(0, r.width + d * 2);\n const h = Math.max(0, r.height + d * 2);\n roundedRect(\n ctx,\n r.x - d,\n r.y - d,\n w,\n h,\n Math.max(0, Math.min(radius + d, w / 2, h / 2)),\n );\n};\n\n/**\n * A lifted shape: the lift shadow under a halo of the background, an\n * optional accent line around the halo, the fill, a ring inside the edge\n */\nconst drawLifted = (\n ctx: CanvasRenderingContext2D,\n r: { x: number; y: number; width: number; height: number },\n radius: number,\n fill: string,\n backdrop: boolean,\n ring: { color: string; width: number } | null,\n halo: number,\n accent: { color: string; width: number } | null,\n theme: ChartScene[\"theme\"],\n) => {\n const background = toCss(theme.background);\n if (ring) {\n ctx.save();\n ctx.shadowColor = \"rgba(15, 23, 42, 0.4)\";\n ctx.shadowBlur = 14;\n ctx.shadowOffsetY = 5;\n grownRect(ctx, r, radius, halo + (accent?.width ?? 0));\n ctx.fillStyle = accent ? accent.color : background;\n ctx.fill();\n ctx.restore();\n if (accent) {\n grownRect(ctx, r, radius, halo);\n ctx.fillStyle = background;\n ctx.fill();\n }\n } else if (backdrop) {\n grownRect(ctx, r, radius, 0);\n ctx.fillStyle = background;\n ctx.fill();\n }\n grownRect(ctx, r, radius, 0);\n ctx.fillStyle = fill;\n ctx.fill();\n if (ring && ring.width > 0) {\n grownRect(ctx, r, radius, -ring.width / 2);\n ctx.lineWidth = ring.width;\n ctx.strokeStyle = ring.color;\n ctx.stroke();\n }\n};\n\n/** Hovered bars (thicker, clipped to the plot) and heatmap cells, lifted */\nconst drawLiftedMarks = (\n ctx: CanvasRenderingContext2D,\n marks: readonly HoverMark[],\n plot: { x: number; y: number; width: number; height: number },\n theme: ChartScene[\"theme\"],\n) => {\n for (const mark of marks) {\n if (mark.kind === \"bar\") {\n const r = liftedBarRect(mark);\n ctx.save();\n ctx.beginPath();\n ctx.rect(plot.x, plot.y, plot.width, plot.height);\n ctx.clip();\n const ring =\n mark.ring === null\n ? null\n : {\n color: mark.ring,\n width: Math.min(\n mark.backdrop ? 2 : 1.5,\n Math.max(0, (Math.min(r.width, r.height) - 2) / 4),\n ),\n };\n drawLifted(\n ctx,\n r,\n mark.radius,\n mark.color,\n mark.backdrop,\n ring,\n 1.5,\n null,\n theme,\n );\n ctx.restore();\n } else if (mark.kind === \"cell\") {\n const w = mark.width * CELL_LIFT;\n const h = mark.height * CELL_LIFT;\n const r = {\n x: mark.x + (mark.width - w) / 2,\n y: mark.y + (mark.height - h) / 2,\n width: w,\n height: h,\n };\n drawLifted(\n ctx,\n r,\n Math.max(2, mark.radius) * CELL_LIFT,\n mark.color,\n false,\n { color: mark.ring, width: Math.min(2, Math.min(w, h) / 5) },\n 2,\n { color: toCss(theme.primary, 0.6), width: 1.5 },\n theme,\n );\n }\n }\n};\n\n/** Draws a scene (legend, axes, data, labels, hover) on a 2D context */\nexport const drawScene = (\n ctx: CanvasRenderingContext2D,\n scene: ChartScene,\n items: readonly RenderItem[],\n origin: Origin,\n pixelRatio: number,\n painter = createCanvas2dPainter(ctx),\n) => {\n const { width, height, theme, model, view, layout } = scene;\n const { plot, scales } = layout;\n const dpr = pixelRatio;\n ctx.setTransform(1, 0, 0, 1, 0, 0);\n ctx.clearRect(0, 0, Math.ceil(width * dpr), Math.ceil(height * dpr));\n ctx.setTransform(dpr, 0, 0, dpr, 0, 0);\n drawBackground(ctx, {\n width,\n height,\n scales,\n x: model.x,\n y: model.y,\n xTicks: layout.xTicks,\n yTicks: layout.yTicks,\n y2: model.y2,\n y2Ticks: layout.y2Ticks,\n theme,\n annotations: scene.annotations,\n });\n\n // color legend of heatmaps\n const ramp = scene.legend?.colors;\n if (ramp) drawColorLegend(ctx, ramp, scene);\n // legend\n if (scene.legend) {\n ctx.font = font(theme, 12);\n ctx.textBaseline = \"middle\";\n ctx.textAlign = \"left\";\n for (const e of scene.legend.entries) {\n const cy = e.box.y + e.box.height / 2;\n ctx.globalAlpha = e.hidden ? 0.45 : 1;\n ctx.fillStyle = e.color;\n if (e.shape === \"dot\") {\n ctx.beginPath();\n ctx.arc(e.box.x + 5, cy, 4, 0, Math.PI * 2);\n ctx.fill();\n } else if (e.shape === \"line\") {\n ctx.fillRect(e.box.x, cy - 1, 10, 2);\n } else {\n ctx.fillRect(e.box.x + 1, cy - 4, 8, 8);\n }\n ctx.fillStyle = toCss(theme.textMuted);\n ctx.fillText(e.name, e.box.x + 14, cy);\n if (e.hidden) {\n const w = e.box.width - 22;\n ctx.fillRect(e.box.x + 14, cy, w, 1);\n }\n }\n ctx.globalAlpha = 1;\n }\n\n // hover band of bars, below the data (lighter behind lifted bars)\n const lifted = scene.hover?.marks.some((m) => m.kind === \"bar\") ?? false;\n for (const mark of scene.hover?.marks ?? []) {\n if (mark.kind !== \"band\") continue;\n roundedRect(ctx, mark.x, mark.y, mark.width, mark.height, 6);\n ctx.fillStyle = toCss(theme.text, lifted ? 0.04 : 0.06);\n ctx.fill();\n }\n\n // data (horizontal charts: as shapes, the painter draws vertical charts)\n if (scales.horizontal) {\n drawPrimitives(ctx, scenePrimitives(scene), plot);\n } else {\n paintData();\n }\n function paintData() {\n const scale = (range: [number, number], o: number, reverse: boolean) => {\n const s = 2 / (range[1] - range[0]);\n const offset = (o - range[0]) * s - 1;\n return reverse ? [-s, -offset] : [s, offset];\n };\n const [xScale, xOffset] = scale(view.x, origin.x, model.x.reverse);\n const [yScale, yOffset] = scale(view.y, origin.y, model.y.reverse);\n painter.paint(\n items,\n {\n transform: { xScale, xOffset, yScale, yOffset },\n width: Math.max(1, Math.round(plot.width * dpr)),\n height: Math.max(1, Math.round(plot.height * dpr)),\n dpr,\n },\n Math.round(plot.x * dpr),\n Math.round(plot.y * dpr),\n );\n }\n\n ctx.setTransform(dpr, 0, 0, dpr, 0, 0);\n // soft row / column of a hovered heatmap cell, over the data\n for (const mark of scene.hover?.marks ?? []) {\n if (mark.kind !== \"guide\") continue;\n ctx.fillStyle = toCss(theme.text, 0.06);\n ctx.fillRect(mark.x, mark.y, mark.width, mark.height);\n }\n // lifted bars and cells, below the value labels; the plot behind lifted\n // bars is veiled so the hovered one stands out\n if (lifted) {\n ctx.fillStyle = toCss(theme.background, 0.42);\n ctx.fillRect(plot.x, plot.y, plot.width, plot.height);\n }\n if (scene.hover) drawLiftedMarks(ctx, scene.hover.marks, plot, theme);\n drawForeground(ctx, {\n width,\n height,\n scales,\n theme,\n annotations: scene.annotations,\n pointLabels: [],\n clear: false,\n connectors: scene.connectors,\n arrows: scene.arrows,\n });\n // dot labels placed by the scene\n if (scene.pointLabels.length) {\n ctx.save();\n ctx.font = font(theme);\n ctx.textAlign = \"left\";\n ctx.textBaseline = \"middle\";\n ctx.lineWidth = 3;\n ctx.lineJoin = \"round\";\n ctx.strokeStyle = toCss(theme.background, 0.9);\n ctx.fillStyle = toCss(theme.text, 0.85);\n for (const { label, box } of scene.pointLabels) {\n const y = box.y + box.height / 2;\n if (label.color) {\n // inside a solid bar: its contrasting color, no halo\n ctx.save();\n ctx.fillStyle = label.color;\n ctx.fillText(label.text, box.x, y);\n ctx.restore();\n continue;\n }\n ctx.strokeText(label.text, box.x, y);\n ctx.fillText(label.text, box.x, y);\n }\n ctx.restore();\n }\n\n // hover\n const hover = scene.hover;\n if (hover) {\n if (hover.crosshairX !== null) {\n ctx.save();\n ctx.strokeStyle = toCss(theme.textMuted, 0.55);\n ctx.lineWidth = 1;\n ctx.setLineDash([3, 3]);\n ctx.beginPath();\n const cx = Math.round(hover.crosshairX) + 0.5;\n ctx.moveTo(cx, plot.y);\n ctx.lineTo(cx, plot.y + plot.height);\n ctx.stroke();\n ctx.restore();\n }\n if (hover.crosshairY !== null) {\n ctx.save();\n ctx.strokeStyle = toCss(theme.textMuted, 0.55);\n ctx.lineWidth = 1;\n ctx.setLineDash([3, 3]);\n ctx.beginPath();\n const cy = Math.round(hover.crosshairY) + 0.5;\n ctx.moveTo(plot.x, cy);\n ctx.lineTo(plot.x + plot.width, cy);\n ctx.stroke();\n ctx.restore();\n }\n for (const mark of hover.marks) {\n if (\n mark.kind === \"band\" ||\n mark.kind === \"guide\" ||\n mark.kind === \"bar\" ||\n mark.kind === \"cell\"\n )\n continue;\n ctx.beginPath();\n ctx.arc(mark.x, mark.y, mark.size / 2 + 4, 0, Math.PI * 2);\n ctx.fillStyle = mark.halo;\n ctx.fill();\n ctx.beginPath();\n ctx.arc(mark.x, mark.y, mark.size / 2 - 1, 0, Math.PI * 2);\n ctx.fillStyle = mark.color;\n ctx.fill();\n ctx.lineWidth = 2;\n ctx.strokeStyle = toCss(theme.background);\n ctx.stroke();\n }\n }\n if (scene.dragging) {\n const d = scene.dragging;\n ctx.beginPath();\n ctx.arc(d.x, d.y, d.size / 2, 0, Math.PI * 2);\n ctx.fillStyle = d.color;\n ctx.globalAlpha = 0.85;\n ctx.fill();\n ctx.globalAlpha = 1;\n ctx.lineWidth = 2;\n ctx.strokeStyle = toCss(theme.background);\n ctx.stroke();\n }\n const tip = hover?.tooltip;\n if (tip) {\n const { box, lineHeight, padding } = tip;\n ctx.save();\n ctx.shadowColor = \"rgba(15, 23, 42, 0.18)\";\n ctx.shadowBlur = 16;\n ctx.shadowOffsetY = 6;\n roundedRect(ctx, box.x, box.y, box.width, box.height, 8);\n ctx.fillStyle = toCss(theme.background, CANVAS_TOOLTIP_ALPHA);\n ctx.fill();\n ctx.restore();\n roundedRect(\n ctx,\n box.x + 0.5,\n box.y + 0.5,\n box.width - 1,\n box.height - 1,\n 8,\n );\n ctx.strokeStyle = toCss(theme.axis, 0.6);\n ctx.lineWidth = 1;\n ctx.stroke();\n ctx.textBaseline = \"middle\";\n let y = box.y + padding + lineHeight / 2;\n const left = box.x + padding + 2;\n const right = box.x + box.width - padding - 2;\n if (tip.text) {\n ctx.font = font(theme, 12);\n ctx.fillStyle = toCss(theme.text);\n ctx.textAlign = \"left\";\n for (const line of tip.text) {\n ctx.fillText(line, left, y);\n y += lineHeight;\n }\n } else {\n const { content } = tip;\n let x = left;\n if (content.titleColor) {\n ctx.fillStyle = content.titleColor;\n ctx.beginPath();\n ctx.arc(x + 4, y, 4, 0, Math.PI * 2);\n ctx.fill();\n x += 14;\n }\n ctx.font = font(theme, 12, 600);\n ctx.fillStyle = toCss(theme.text);\n ctx.textAlign = \"left\";\n ctx.fillText(content.title, x, y);\n y += lineHeight;\n if (content.subtitle) {\n ctx.font = font(theme, 11);\n ctx.fillStyle = toCss(theme.textMuted);\n ctx.fillText(content.subtitle, x, y - 2);\n y += lineHeight;\n }\n for (const row of content.rows) {\n x = left;\n if (row.color) {\n ctx.fillStyle = row.color;\n ctx.beginPath();\n ctx.arc(x + 4, y, 4, 0, Math.PI * 2);\n ctx.fill();\n }\n // names in one column, values right-aligned in another\n x += tip.swatchWidth;\n ctx.font = font(theme, 12);\n ctx.textAlign = \"left\";\n ctx.fillStyle = toCss(theme.textMuted);\n ctx.fillText(row.name, x, y);\n ctx.font = font(theme, 12, 600);\n ctx.textAlign = \"right\";\n ctx.fillStyle = toCss(theme.text);\n ctx.fillText(row.value, right, y);\n y += lineHeight;\n }\n }\n }\n};\n\n/**\n * Creates a chart drawn on a 2D canvas: line, area, bar and scatter series,\n * annotations, legend and tooltip, tap / drag / pinch gestures. Works\n * without a DOM (mini-programs); see `createChart` for the GPU version of\n * the web.\n */\nexport const createCanvasChart = (\n config: CanvasChartConfig,\n): CanvasChartInstance => {\n const { canvas } = config;\n const ctx = canvas.getContext(\"2d\") as CanvasRenderingContext2D | null;\n let width = config.width;\n let height = config.height;\n let dpr = config.pixelRatio ?? 1;\n let destroyed = false;\n let frameId: number | null = null;\n let items: RenderItem[] = [];\n let itemsModel: unknown = null;\n let itemsKey0 = \"\";\n let itemsKey = \"\";\n let options = config.options;\n /** Ids of the themes seen (the controller replaces its theme on changes) */\n const themeIds = new WeakMap<object, number>();\n let themeCount = 0;\n const themeId = (theme: object) => {\n let id = themeIds.get(theme);\n if (id === undefined) themeIds.set(theme, (id = ++themeCount));\n return id;\n };\n let origin: Origin = { x: 0, y: 0 };\n let version = 0;\n let fontSet = \"\";\n\n const measureText = (text: string, f: string) => {\n if (!ctx) return text.length * 6.5;\n if (f !== fontSet) {\n ctx.font = f;\n fontSet = f;\n }\n return ctx.measureText(text).width;\n };\n\n const painter = ctx ? createCanvas2dPainter(ctx) : null;\n\n const g = globalThis as {\n requestAnimationFrame?: (cb: () => void) => number;\n cancelAnimationFrame?: (id: number) => void;\n };\n\n const render = () => {\n frameId = null;\n if (destroyed || !ctx || !painter) return;\n const scene = controller.getScene();\n if (!scene) return;\n const pw = Math.max(1, Math.round(width * dpr));\n const ph = Math.max(1, Math.round(height * dpr));\n if (canvas.width !== pw) canvas.width = pw;\n if (canvas.height !== ph) canvas.height = ph;\n fontSet = \"\";\n if (itemsModel !== scene.model) {\n itemsModel = scene.model;\n // a new model (any setOptions) keeps the items when nothing they\n // depend on changed\n itemsKey0 = itemsSignature(\n scene.model,\n themeId(scene.theme),\n (index) => options.series[index]?.stack,\n );\n }\n // heatmap cells: their gaps and corners follow their size on screen\n const sc = scene.layout.scales;\n const density = { x: 1 / Math.abs(sc.xPerPx), y: 1 / Math.abs(sc.yPerPx) };\n const key = `${itemsKey0}|${cellStyleKey(scene.model, density)}`;\n if (key !== itemsKey) {\n itemsKey = key;\n origin = { x: mid(scene.model.base.x), y: mid(scene.model.base.y) };\n items = buildItems(scene.model, origin, ++version, density);\n }\n drawScene(ctx, scene, items, origin, dpr, painter);\n fontSet = \"\";\n };\n\n const schedule = () => {\n if (destroyed || frameId !== null) return;\n if (canvas.requestAnimationFrame)\n frameId = canvas.requestAnimationFrame(render);\n else if (g.requestAnimationFrame) frameId = g.requestAnimationFrame(render);\n else frameId = setTimeout(render, 16) as unknown as number;\n };\n\n const controller = createChartController({\n options: config.options,\n theme: config.theme,\n measureText,\n onInvalidate: schedule,\n });\n controller.setSize(width, height);\n\n const touchOptions = (t: ChartTouch, i: number): ChartPointerOptions => ({\n id: t.identifier ?? i,\n touch: true,\n });\n\n return {\n setOptions: (o) => {\n options = o;\n controller.setOptions(o);\n },\n setTheme: (t) => controller.setTheme(t),\n resize(w, h, ratio) {\n width = w;\n height = h;\n if (ratio) dpr = ratio;\n controller.setSize(w, h);\n schedule();\n },\n render() {\n if (frameId !== null) {\n if (canvas.cancelAnimationFrame) canvas.cancelAnimationFrame(frameId);\n else if (g.cancelAnimationFrame) g.cancelAnimationFrame(frameId);\n else clearTimeout(frameId);\n }\n render();\n },\n touchStart(touches) {\n touches.forEach((t, i) =>\n controller.pointerDown(t.x, t.y, touchOptions(t, i)),\n );\n },\n touchMove(touches) {\n touches.forEach((t, i) =>\n controller.pointerMove(t.x, t.y, touchOptions(t, i)),\n );\n },\n touchEnd(touches) {\n touches.forEach((t, i) =>\n controller.pointerUp(t.x, t.y, touchOptions(t, i)),\n );\n },\n touchCancel(touches = [{ x: 0, y: 0 }]) {\n touches.forEach((t, i) => controller.pointerCancel(touchOptions(t, i)));\n },\n pointerDown: (x, y, o) => controller.pointerDown(x, y, o),\n pointerMove: (x, y, o) => controller.pointerMove(x, y, o),\n pointerUp: (x, y, o) => controller.pointerUp(x, y, o),\n pointerLeave: () => controller.pointerLeave(),\n zoomAt: (x, y, f) => controller.zoomAt(x, y, f),\n resetZoom: () => controller.resetZoom(),\n getView: () => controller.getView(),\n setView: (v) => controller.setView(v),\n toggleSeries: (id) => controller.toggleSeries(id),\n clearHover: () => controller.clearHover(),\n getPlotRect: () => controller.getPlotRect(),\n toPixel: (x, y) => controller.toPixel(x, y),\n fromPixel: (x, y) => controller.fromPixel(x, y),\n getController: () => controller,\n on: (type, listener) => controller.on(type, listener),\n destroy() {\n if (destroyed) return;\n destroyed = true;\n if (frameId !== null) {\n if (canvas.cancelAnimationFrame) canvas.cancelAnimationFrame(frameId);\n else if (g.cancelAnimationFrame) g.cancelAnimationFrame(frameId);\n else clearTimeout(frameId);\n }\n painter?.destroy();\n controller.destroy();\n },\n };\n};\n"],"mappings":"wOAiGA,IAAMkB,EAAO,IAAyBC,EAAE,GAAKA,EAAE,IAAM,EAE/CC,GACJ,EACA,EACA,EACA,EACA,EACA,IACG,CACHC,EAAI,UAAU,EACdA,EAAI,OAAOC,EAAIH,EAAGI,CAAC,EACnBF,EAAI,OAAOC,EAAIE,EAAIL,EAAGI,CAAC,EACvBF,EAAI,MAAMC,EAAIE,EAAGD,EAAGD,EAAIE,EAAGD,EAAIJ,EAAGA,CAAC,EACnCE,EAAI,OAAOC,EAAIE,EAAGD,EAAIE,EAAIN,CAAC,EAC3BE,EAAI,MAAMC,EAAIE,EAAGD,EAAIE,EAAGH,EAAIE,EAAIL,EAAGI,EAAIE,EAAGN,CAAC,EAC3CE,EAAI,OAAOC,EAAIH,EAAGI,EAAIE,CAAC,EACvBJ,EAAI,MAAMC,EAAGC,EAAIE,EAAGH,EAAGC,EAAIE,EAAIN,EAAGA,CAAC,EACnCE,EAAI,OAAOC,EAAGC,EAAIJ,CAAC,EACnBE,EAAI,MAAMC,EAAGC,EAAGD,EAAIH,EAAGI,EAAGJ,CAAC,EAC3BE,EAAI,UAAU,CAChB,EAMaK,GACX,EACA,EACA,IACG,CACHL,EAAI,KAAK,EACTA,EAAI,UAAU,EACdA,EAAI,KAAKM,EAAK,EAAGA,EAAK,EAAGA,EAAK,MAAOA,EAAK,MAAM,EAChDN,EAAI,KAAK,EACT,EAAI,SAAW,QACf,EAAI,QAAU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