minerva-design 1.1.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/dist/charts/canvas.d.cts +10 -0
- package/dist/charts/canvas.d.ts +10 -0
- package/dist/charts/core.cjs +1 -1
- package/dist/charts/core.d.cts +8 -1
- package/dist/charts/core.d.ts +8 -1
- package/dist/charts/core.js +6 -1
- package/dist/charts/engine/canvas.cjs +2 -0
- package/dist/charts/engine/canvas.cjs.map +1 -0
- package/dist/charts/engine/canvas.d.cts +85 -0
- package/dist/charts/engine/canvas.d.ts +85 -0
- package/dist/charts/engine/canvas.js +177 -0
- package/dist/charts/engine/canvas.js.map +1 -0
- package/dist/charts/engine/chart.cjs +1 -2
- package/dist/charts/engine/chart.cjs.map +1 -1
- package/dist/charts/engine/chart.js +450 -489
- package/dist/charts/engine/chart.js.map +1 -1
- package/dist/charts/engine/color.cjs +1 -1
- package/dist/charts/engine/color.cjs.map +1 -1
- package/dist/charts/engine/color.d.cts +27 -0
- package/dist/charts/engine/color.d.ts +27 -0
- package/dist/charts/engine/color.js +100 -4
- package/dist/charts/engine/color.js.map +1 -1
- package/dist/charts/engine/controller.cjs +3 -0
- package/dist/charts/engine/controller.cjs.map +1 -0
- package/dist/charts/engine/controller.d.cts +188 -0
- package/dist/charts/engine/controller.d.ts +188 -0
- package/dist/charts/engine/controller.js +592 -0
- package/dist/charts/engine/controller.js.map +1 -0
- package/dist/charts/engine/curve.cjs +2 -0
- package/dist/charts/engine/curve.cjs.map +1 -0
- package/dist/charts/engine/curve.d.cts +15 -0
- package/dist/charts/engine/curve.d.ts +15 -0
- package/dist/charts/engine/curve.js +56 -0
- package/dist/charts/engine/curve.js.map +1 -0
- package/dist/charts/engine/data.cjs +1 -1
- package/dist/charts/engine/data.cjs.map +1 -1
- package/dist/charts/engine/data.d.cts +15 -2
- package/dist/charts/engine/data.d.ts +15 -2
- package/dist/charts/engine/data.js +98 -38
- package/dist/charts/engine/data.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 +5 -3
- package/dist/charts/engine/dom.d.ts +5 -3
- package/dist/charts/engine/dom.js +27 -22
- package/dist/charts/engine/dom.js.map +1 -1
- package/dist/charts/engine/items.cjs +1 -1
- package/dist/charts/engine/items.cjs.map +1 -1
- package/dist/charts/engine/items.js +132 -61
- package/dist/charts/engine/items.js.map +1 -1
- package/dist/charts/engine/model.cjs +1 -1
- package/dist/charts/engine/model.cjs.map +1 -1
- package/dist/charts/engine/model.d.cts +32 -5
- package/dist/charts/engine/model.d.ts +32 -5
- package/dist/charts/engine/model.js +226 -109
- package/dist/charts/engine/model.js.map +1 -1
- package/dist/charts/engine/overlay.cjs +1 -1
- package/dist/charts/engine/overlay.cjs.map +1 -1
- package/dist/charts/engine/overlay.d.cts +19 -1
- package/dist/charts/engine/overlay.d.ts +19 -1
- package/dist/charts/engine/overlay.js +77 -63
- package/dist/charts/engine/overlay.js.map +1 -1
- package/dist/charts/engine/presets.cjs +3 -0
- package/dist/charts/engine/presets.cjs.map +1 -0
- package/dist/charts/engine/presets.d.cts +169 -0
- package/dist/charts/engine/presets.d.ts +169 -0
- package/dist/charts/engine/presets.js +240 -0
- package/dist/charts/engine/presets.js.map +1 -0
- package/dist/charts/engine/renderers/canvas2d.cjs +1 -1
- package/dist/charts/engine/renderers/canvas2d.cjs.map +1 -1
- package/dist/charts/engine/renderers/canvas2d.d.cts +17 -1
- package/dist/charts/engine/renderers/canvas2d.d.ts +17 -1
- package/dist/charts/engine/renderers/canvas2d.js +176 -101
- package/dist/charts/engine/renderers/canvas2d.js.map +1 -1
- package/dist/charts/engine/renderers/range.cjs +1 -1
- package/dist/charts/engine/renderers/range.cjs.map +1 -1
- package/dist/charts/engine/renderers/range.js +4 -4
- package/dist/charts/engine/renderers/range.js.map +1 -1
- package/dist/charts/engine/renderers/shaders.cjs +37 -19
- package/dist/charts/engine/renderers/shaders.cjs.map +1 -1
- package/dist/charts/engine/renderers/shaders.d.cts +2 -2
- package/dist/charts/engine/renderers/shaders.d.ts +2 -2
- package/dist/charts/engine/renderers/shaders.js +37 -19
- package/dist/charts/engine/renderers/shaders.js.map +1 -1
- package/dist/charts/engine/renderers/types.cjs.map +1 -1
- package/dist/charts/engine/renderers/types.d.cts +11 -4
- package/dist/charts/engine/renderers/types.d.ts +11 -4
- package/dist/charts/engine/renderers/types.js.map +1 -1
- package/dist/charts/engine/renderers/webgl2.cjs +1 -1
- package/dist/charts/engine/renderers/webgl2.cjs.map +1 -1
- package/dist/charts/engine/renderers/webgl2.js +33 -12
- package/dist/charts/engine/renderers/webgl2.js.map +1 -1
- package/dist/charts/engine/renderers/webgpu.cjs +1 -1
- package/dist/charts/engine/renderers/webgpu.cjs.map +1 -1
- package/dist/charts/engine/renderers/webgpu.js +18 -15
- package/dist/charts/engine/renderers/webgpu.js.map +1 -1
- package/dist/charts/engine/scene.cjs +2 -0
- package/dist/charts/engine/scene.cjs.map +1 -0
- package/dist/charts/engine/scene.d.cts +102 -0
- package/dist/charts/engine/scene.d.ts +102 -0
- package/dist/charts/engine/scene.js +353 -0
- package/dist/charts/engine/scene.js.map +1 -0
- package/dist/charts/engine/shapes/canvas.cjs +2 -0
- package/dist/charts/engine/shapes/canvas.cjs.map +1 -0
- package/dist/charts/engine/shapes/canvas.d.cts +58 -0
- package/dist/charts/engine/shapes/canvas.d.ts +58 -0
- package/dist/charts/engine/shapes/canvas.js +159 -0
- package/dist/charts/engine/shapes/canvas.js.map +1 -0
- package/dist/charts/engine/shapes/chart.cjs +2 -0
- package/dist/charts/engine/shapes/chart.cjs.map +1 -0
- package/dist/charts/engine/shapes/chart.d.cts +6 -0
- package/dist/charts/engine/shapes/chart.d.ts +6 -0
- package/dist/charts/engine/shapes/chart.js +273 -0
- package/dist/charts/engine/shapes/chart.js.map +1 -0
- package/dist/charts/engine/shapes/draw.cjs +2 -0
- package/dist/charts/engine/shapes/draw.cjs.map +1 -0
- package/dist/charts/engine/shapes/draw.d.cts +20 -0
- package/dist/charts/engine/shapes/draw.d.ts +20 -0
- package/dist/charts/engine/shapes/draw.js +152 -0
- package/dist/charts/engine/shapes/draw.js.map +1 -0
- package/dist/charts/engine/shapes/funnel.cjs +2 -0
- package/dist/charts/engine/shapes/funnel.cjs.map +1 -0
- package/dist/charts/engine/shapes/funnel.d.cts +6 -0
- package/dist/charts/engine/shapes/funnel.d.ts +6 -0
- package/dist/charts/engine/shapes/funnel.js +149 -0
- package/dist/charts/engine/shapes/funnel.js.map +1 -0
- package/dist/charts/engine/shapes/gauge.cjs +2 -0
- package/dist/charts/engine/shapes/gauge.cjs.map +1 -0
- package/dist/charts/engine/shapes/gauge.d.cts +7 -0
- package/dist/charts/engine/shapes/gauge.d.ts +7 -0
- package/dist/charts/engine/shapes/gauge.js +173 -0
- package/dist/charts/engine/shapes/gauge.js.map +1 -0
- package/dist/charts/engine/shapes/hit.cjs +2 -0
- package/dist/charts/engine/shapes/hit.cjs.map +1 -0
- package/dist/charts/engine/shapes/hit.d.cts +28 -0
- package/dist/charts/engine/shapes/hit.d.ts +28 -0
- package/dist/charts/engine/shapes/hit.js +124 -0
- package/dist/charts/engine/shapes/hit.js.map +1 -0
- package/dist/charts/engine/shapes/index.d.cts +9 -0
- package/dist/charts/engine/shapes/index.d.ts +9 -0
- package/dist/charts/engine/shapes/layout.cjs +3 -0
- package/dist/charts/engine/shapes/layout.cjs.map +1 -0
- package/dist/charts/engine/shapes/layout.d.cts +88 -0
- package/dist/charts/engine/shapes/layout.d.ts +88 -0
- package/dist/charts/engine/shapes/layout.js +266 -0
- package/dist/charts/engine/shapes/layout.js.map +1 -0
- package/dist/charts/engine/shapes/pie.cjs +2 -0
- package/dist/charts/engine/shapes/pie.cjs.map +1 -0
- package/dist/charts/engine/shapes/pie.d.cts +20 -0
- package/dist/charts/engine/shapes/pie.d.ts +20 -0
- package/dist/charts/engine/shapes/pie.js +302 -0
- package/dist/charts/engine/shapes/pie.js.map +1 -0
- package/dist/charts/engine/shapes/radar.cjs +2 -0
- package/dist/charts/engine/shapes/radar.cjs.map +1 -0
- package/dist/charts/engine/shapes/radar.d.cts +8 -0
- package/dist/charts/engine/shapes/radar.d.ts +8 -0
- package/dist/charts/engine/shapes/radar.js +197 -0
- package/dist/charts/engine/shapes/radar.js.map +1 -0
- package/dist/charts/engine/shapes/runtime.cjs +2 -0
- package/dist/charts/engine/shapes/runtime.cjs.map +1 -0
- package/dist/charts/engine/shapes/runtime.d.cts +29 -0
- package/dist/charts/engine/shapes/runtime.d.ts +29 -0
- package/dist/charts/engine/shapes/runtime.js +97 -0
- package/dist/charts/engine/shapes/runtime.js.map +1 -0
- package/dist/charts/engine/shapes/scene.cjs +2 -0
- package/dist/charts/engine/shapes/scene.cjs.map +1 -0
- package/dist/charts/engine/shapes/scene.d.cts +257 -0
- package/dist/charts/engine/shapes/scene.d.ts +257 -0
- package/dist/charts/engine/shapes/scene.js +123 -0
- package/dist/charts/engine/shapes/scene.js.map +1 -0
- package/dist/charts/engine/shapes/treemap.cjs +2 -0
- package/dist/charts/engine/shapes/treemap.cjs.map +1 -0
- package/dist/charts/engine/shapes/treemap.d.cts +14 -0
- package/dist/charts/engine/shapes/treemap.d.ts +14 -0
- package/dist/charts/engine/shapes/treemap.js +213 -0
- package/dist/charts/engine/shapes/treemap.js.map +1 -0
- package/dist/charts/engine/shapes/types.d.cts +292 -0
- package/dist/charts/engine/shapes/types.d.ts +292 -0
- package/dist/charts/engine/signature.cjs +2 -0
- package/dist/charts/engine/signature.cjs.map +1 -0
- package/dist/charts/engine/signature.d.cts +9 -0
- package/dist/charts/engine/signature.d.ts +9 -0
- package/dist/charts/engine/signature.js +13 -0
- package/dist/charts/engine/signature.js.map +1 -0
- package/dist/charts/engine/theme.cjs +1 -1
- package/dist/charts/engine/theme.cjs.map +1 -1
- package/dist/charts/engine/theme.d.cts +35 -2
- package/dist/charts/engine/theme.d.ts +35 -2
- package/dist/charts/engine/theme.js +66 -26
- package/dist/charts/engine/theme.js.map +1 -1
- package/dist/charts/engine/types.d.cts +139 -11
- package/dist/charts/engine/types.d.ts +139 -11
- package/dist/charts/index.cjs +1 -1
- package/dist/charts/index.d.cts +4 -2
- package/dist/charts/index.d.ts +4 -2
- package/dist/charts/index.js +8 -2
- package/dist/charts/react/Chart.cjs +1 -1
- package/dist/charts/react/Chart.cjs.map +1 -1
- package/dist/charts/react/Chart.d.cts +18 -4
- package/dist/charts/react/Chart.d.ts +18 -4
- package/dist/charts/react/Chart.js +102 -41
- package/dist/charts/react/Chart.js.map +1 -1
- package/dist/charts/react/charts.cjs +1 -1
- package/dist/charts/react/charts.cjs.map +1 -1
- package/dist/charts/react/charts.d.cts +11 -3
- package/dist/charts/react/charts.d.ts +11 -3
- package/dist/charts/react/charts.js +221 -144
- package/dist/charts/react/charts.js.map +1 -1
- package/dist/charts/react/shapes.cjs +2 -0
- package/dist/charts/react/shapes.cjs.map +1 -0
- package/dist/charts/react/shapes.d.cts +255 -0
- package/dist/charts/react/shapes.d.ts +255 -0
- package/dist/charts/react/shapes.js +242 -0
- package/dist/charts/react/shapes.js.map +1 -0
- package/dist/charts/react/types.d.cts +100 -63
- package/dist/charts/react/types.d.ts +100 -63
- package/dist/native/charts/src/canvas.cjs +1 -0
- package/dist/native/charts/src/canvas.js +6 -0
- package/dist/native/charts/src/engine/axis.cjs +2 -0
- package/dist/native/charts/src/engine/axis.cjs.map +1 -0
- package/dist/native/charts/src/engine/axis.js +38 -0
- package/dist/native/charts/src/engine/axis.js.map +1 -0
- package/dist/native/charts/src/engine/canvas.cjs +1 -0
- package/dist/native/charts/src/engine/canvas.js +1 -0
- package/dist/native/charts/src/engine/color.cjs +2 -0
- package/dist/native/charts/src/engine/color.cjs.map +1 -0
- package/dist/native/charts/src/engine/color.js +139 -0
- package/dist/native/charts/src/engine/color.js.map +1 -0
- package/dist/native/charts/src/engine/controller.cjs +3 -0
- package/dist/native/charts/src/engine/controller.cjs.map +1 -0
- package/dist/native/charts/src/engine/controller.js +592 -0
- package/dist/native/charts/src/engine/controller.js.map +1 -0
- package/dist/native/charts/src/engine/curve.cjs +2 -0
- package/dist/native/charts/src/engine/curve.cjs.map +1 -0
- package/dist/native/charts/src/engine/curve.js +56 -0
- package/dist/native/charts/src/engine/curve.js.map +1 -0
- package/dist/native/charts/src/engine/data.cjs +2 -0
- package/dist/native/charts/src/engine/data.cjs.map +1 -0
- package/dist/native/charts/src/engine/data.js +164 -0
- package/dist/native/charts/src/engine/data.js.map +1 -0
- package/dist/native/charts/src/engine/decimate.cjs +2 -0
- package/dist/native/charts/src/engine/decimate.cjs.map +1 -0
- package/dist/native/charts/src/engine/decimate.js +28 -0
- package/dist/native/charts/src/engine/decimate.js.map +1 -0
- package/dist/native/charts/src/engine/format.cjs +2 -0
- package/dist/native/charts/src/engine/format.cjs.map +1 -0
- package/dist/native/charts/src/engine/format.js +34 -0
- package/dist/native/charts/src/engine/format.js.map +1 -0
- package/dist/native/charts/src/engine/layout.cjs +2 -0
- package/dist/native/charts/src/engine/layout.cjs.map +1 -0
- package/dist/native/charts/src/engine/layout.js +26 -0
- package/dist/native/charts/src/engine/layout.js.map +1 -0
- package/dist/native/charts/src/engine/model.cjs +2 -0
- package/dist/native/charts/src/engine/model.cjs.map +1 -0
- package/dist/native/charts/src/engine/model.js +292 -0
- package/dist/native/charts/src/engine/model.js.map +1 -0
- package/dist/native/charts/src/engine/overlay.cjs +2 -0
- package/dist/native/charts/src/engine/overlay.cjs.map +1 -0
- package/dist/native/charts/src/engine/overlay.js +49 -0
- package/dist/native/charts/src/engine/overlay.js.map +1 -0
- package/dist/native/charts/src/engine/presets.cjs +3 -0
- package/dist/native/charts/src/engine/presets.cjs.map +1 -0
- package/dist/native/charts/src/engine/presets.js +154 -0
- package/dist/native/charts/src/engine/presets.js.map +1 -0
- package/dist/native/charts/src/engine/scale.cjs +2 -0
- package/dist/native/charts/src/engine/scale.cjs.map +1 -0
- package/dist/native/charts/src/engine/scale.js +37 -0
- package/dist/native/charts/src/engine/scale.js.map +1 -0
- package/dist/native/charts/src/engine/scene.cjs +2 -0
- package/dist/native/charts/src/engine/scene.cjs.map +1 -0
- package/dist/native/charts/src/engine/scene.js +353 -0
- package/dist/native/charts/src/engine/scene.js.map +1 -0
- package/dist/native/charts/src/engine/spatial.cjs +2 -0
- package/dist/native/charts/src/engine/spatial.cjs.map +1 -0
- package/dist/native/charts/src/engine/spatial.js +53 -0
- package/dist/native/charts/src/engine/spatial.js.map +1 -0
- package/dist/native/charts/src/engine/theme.cjs +2 -0
- package/dist/native/charts/src/engine/theme.cjs.map +1 -0
- package/dist/native/charts/src/engine/theme.js +62 -0
- package/dist/native/charts/src/engine/theme.js.map +1 -0
- package/dist/native/charts/src/engine/time.cjs +2 -0
- package/dist/native/charts/src/engine/time.cjs.map +1 -0
- package/dist/native/charts/src/engine/time.js +189 -0
- package/dist/native/charts/src/engine/time.js.map +1 -0
- package/dist/native/charts/src/engine/viewport.cjs +2 -0
- package/dist/native/charts/src/engine/viewport.cjs.map +1 -0
- package/dist/native/charts/src/engine/viewport.js +12 -0
- package/dist/native/charts/src/engine/viewport.js.map +1 -0
- package/dist/native/components/Chart/ChartBase.cjs +2 -0
- package/dist/native/components/Chart/ChartBase.cjs.map +1 -0
- package/dist/native/components/Chart/ChartBase.d.cts +29 -0
- package/dist/native/components/Chart/ChartBase.d.ts +29 -0
- package/dist/native/components/Chart/ChartBase.js +287 -0
- package/dist/native/components/Chart/ChartBase.js.map +1 -0
- package/dist/native/components/Chart/charts.cjs +2 -0
- package/dist/native/components/Chart/charts.cjs.map +1 -0
- package/dist/native/components/Chart/charts.d.cts +19 -0
- package/dist/native/components/Chart/charts.d.ts +19 -0
- package/dist/native/components/Chart/charts.js +173 -0
- package/dist/native/components/Chart/charts.js.map +1 -0
- package/dist/native/components/Chart/index.cjs +1 -0
- package/dist/native/components/Chart/index.d.cts +2 -0
- package/dist/native/components/Chart/index.d.ts +2 -0
- package/dist/native/components/Chart/index.js +2 -0
- package/dist/native/components/Chart/measure.cjs +2 -0
- package/dist/native/components/Chart/measure.cjs.map +1 -0
- package/dist/native/components/Chart/measure.d.cts +5 -0
- package/dist/native/components/Chart/measure.d.ts +5 -0
- package/dist/native/components/Chart/measure.js +11 -0
- package/dist/native/components/Chart/measure.js.map +1 -0
- package/dist/native/components/Chart/scene.cjs +2 -0
- package/dist/native/components/Chart/scene.cjs.map +1 -0
- package/dist/native/components/Chart/scene.d.cts +41 -0
- package/dist/native/components/Chart/scene.d.ts +41 -0
- package/dist/native/components/Chart/scene.js +431 -0
- package/dist/native/components/Chart/scene.js.map +1 -0
- package/dist/native/components/Chart/theme.cjs +2 -0
- package/dist/native/components/Chart/theme.cjs.map +1 -0
- package/dist/native/components/Chart/theme.d.cts +10 -0
- package/dist/native/components/Chart/theme.d.ts +10 -0
- package/dist/native/components/Chart/theme.js +10 -0
- package/dist/native/components/Chart/theme.js.map +1 -0
- package/dist/native/components/Chart/types.d.cts +129 -0
- package/dist/native/components/Chart/types.d.ts +129 -0
- package/dist/native/index.cjs +1 -1
- package/dist/native/index.d.cts +1 -0
- package/dist/native/index.d.ts +1 -0
- package/dist/native/index.js +6 -4
- package/dist/native/manifest.d.cts +7 -0
- package/dist/native/manifest.d.ts +7 -0
- package/dist/native/source/components/Chart/ChartBase.tsx +545 -0
- package/dist/native/source/components/Chart/charts.tsx +291 -0
- package/dist/native/source/components/Chart/index.ts +8 -0
- package/dist/native/source/components/Chart/measure.ts +50 -0
- package/dist/native/source/components/Chart/scene.tsx +1021 -0
- package/dist/native/source/components/Chart/theme.ts +16 -0
- package/dist/native/source/components/Chart/types.ts +194 -0
- package/dist/native/source/index.ts +1 -0
- package/dist/native/source/manifest.ts +14 -0
- package/dist/taro/charts.d.ts +144 -0
- package/dist/taro/index.d.ts +1 -0
- package/dist/taro/index.js +3544 -618
- package/dist/uni/BarChart.vue +75 -0
- package/dist/uni/BarChart.vue.d.ts +111 -0
- package/dist/uni/Chart.vue +68 -0
- package/dist/uni/Chart.vue.d.ts +100 -0
- package/dist/uni/LineChart.vue +75 -0
- package/dist/uni/LineChart.vue.d.ts +111 -0
- package/dist/uni/ProgressIndicator.vue.d.ts +1 -1
- package/dist/uni/QuadrantChart.vue +184 -0
- package/dist/uni/QuadrantChart.vue.d.ts +173 -0
- package/dist/uni/ScatterChart.vue +69 -0
- package/dist/uni/ScatterChart.vue.d.ts +100 -0
- package/dist/uni/chart-canvas.d.ts +68 -0
- package/dist/uni/chart-canvas.js +363 -0
- package/dist/uni/chart-types.d.ts +135 -0
- package/dist/uni/chart-types.js +84 -0
- package/dist/uni/charts-canvas.d.ts +1 -0
- package/dist/uni/charts-canvas.js +10 -0
- package/dist/uni/index.d.ts +6 -0
- package/dist/uni/index.js +6 -0
- package/dist/weapp/bar-chart/index.js +1 -0
- package/dist/weapp/bar-chart/index.json +1 -0
- package/dist/weapp/bar-chart/index.wxml +1 -0
- package/dist/weapp/bar-chart/index.wxss +1 -0
- package/dist/weapp/chart/index.js +1 -0
- package/dist/weapp/chart/index.json +1 -0
- package/dist/weapp/chart/index.wxml +1 -0
- package/dist/weapp/chart/index.wxss +1 -0
- package/dist/weapp/controls.js +4760 -266
- package/dist/weapp/line-chart/index.js +1 -0
- package/dist/weapp/line-chart/index.json +1 -0
- package/dist/weapp/line-chart/index.wxml +1 -0
- package/dist/weapp/line-chart/index.wxss +1 -0
- package/dist/weapp/quadrant-chart/index.js +1 -0
- package/dist/weapp/quadrant-chart/index.json +1 -0
- package/dist/weapp/quadrant-chart/index.wxml +1 -0
- package/dist/weapp/quadrant-chart/index.wxss +1 -0
- package/dist/weapp/scatter-chart/index.js +1 -0
- package/dist/weapp/scatter-chart/index.json +1 -0
- package/dist/weapp/scatter-chart/index.wxml +1 -0
- package/dist/weapp/scatter-chart/index.wxss +1 -0
- package/dist/weapp/types.d.ts +295 -0
- package/package.json +21 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# minerva-design
|
|
2
2
|
|
|
3
|
+
## 1.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- docs(charts): document the new chart types, the gallery and a performance guide
|
|
8
|
+
feat(charts): add area, candlestick, heatmap, sparkline, pie, radar, gauge, funnel and treemap
|
|
9
|
+
|
|
10
|
+
## 1.2.0
|
|
11
|
+
|
|
12
|
+
### Minor Changes
|
|
13
|
+
|
|
14
|
+
- docs(charts): document canvas charts, mini-program and React Native charts
|
|
15
|
+
feat(charts): add charts for Taro, uni-app, WeChat and React Native
|
|
16
|
+
feat(charts): add headless controller, canvas renderer and draggable points
|
|
17
|
+
|
|
3
18
|
## 1.1.0
|
|
4
19
|
|
|
5
20
|
### Minor Changes
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { createCanvasChart, drawScene, type CanvasChartConfig, type CanvasChartInstance, type ChartCanvas, type ChartTouch, } from './engine/canvas.cjs';
|
|
2
|
+
export { createChartController, scenePrimitives, type ChartAreaPrimitive, type ChartBarPrimitive, type ChartController, type ChartControllerConfig, type ChartControllerEventMap, type ChartDotPrimitive, type ChartHoverLayout, type ChartLegendEntry, type ChartLegendLayout, type ChartLinePrimitive, type ChartPointerOptions, type ChartPrimitive, type ChartPrimitiveOptions, type ChartScene, type ChartTooltipLayout, } from './engine/controller.cjs';
|
|
3
|
+
export { formatCompact } from './engine/format.cjs';
|
|
4
|
+
export { areaSeries, barSeries, candlestickSeries, DEFAULT_QUADRANT_COLORS, heatmapChartOptions, lineSeries, quadrantCenter, quadrantChartOptions, quadrantOf, scatterSeries, sparklineOptions, type HeatmapCell, type HeatmapConfig, type QuadrantAxisLabels, type QuadrantConfig, type QuadrantCorner, type QuadrantPoint, type QuadrantRegion, type QuadrantRegions, type SparklineConfig, } from './engine/presets.cjs';
|
|
5
|
+
export { toCss } from './engine/color.cjs';
|
|
6
|
+
export type { ChartThemeInput } from './engine/theme.cjs';
|
|
7
|
+
export type * from './engine/types.cjs';
|
|
8
|
+
export { createCanvasShapeChart, type CanvasShapeChartConfig, type CanvasShapeChartInstance, } from './engine/shapes/canvas.cjs';
|
|
9
|
+
export { drawShapeScene } from './engine/shapes/draw.cjs';
|
|
10
|
+
export type * from './engine/shapes/types.cjs';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { createCanvasChart, drawScene, type CanvasChartConfig, type CanvasChartInstance, type ChartCanvas, type ChartTouch, } from './engine/canvas.js';
|
|
2
|
+
export { createChartController, scenePrimitives, type ChartAreaPrimitive, type ChartBarPrimitive, type ChartController, type ChartControllerConfig, type ChartControllerEventMap, type ChartDotPrimitive, type ChartHoverLayout, type ChartLegendEntry, type ChartLegendLayout, type ChartLinePrimitive, type ChartPointerOptions, type ChartPrimitive, type ChartPrimitiveOptions, type ChartScene, type ChartTooltipLayout, } from './engine/controller.js';
|
|
3
|
+
export { formatCompact } from './engine/format.js';
|
|
4
|
+
export { areaSeries, barSeries, candlestickSeries, DEFAULT_QUADRANT_COLORS, heatmapChartOptions, lineSeries, quadrantCenter, quadrantChartOptions, quadrantOf, scatterSeries, sparklineOptions, type HeatmapCell, type HeatmapConfig, type QuadrantAxisLabels, type QuadrantConfig, type QuadrantCorner, type QuadrantPoint, type QuadrantRegion, type QuadrantRegions, type SparklineConfig, } from './engine/presets.js';
|
|
5
|
+
export { toCss } from './engine/color.js';
|
|
6
|
+
export type { ChartThemeInput } from './engine/theme.js';
|
|
7
|
+
export type * from './engine/types.js';
|
|
8
|
+
export { createCanvasShapeChart, type CanvasShapeChartConfig, type CanvasShapeChartInstance, } from './engine/shapes/canvas.js';
|
|
9
|
+
export { drawShapeScene } from './engine/shapes/draw.js';
|
|
10
|
+
export type * from './engine/shapes/types.js';
|
package/dist/charts/core.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./engine/format.cjs"),t=require("./engine/chart.cjs");exports.createChart=t.createChart,exports.formatCompact=e.formatCompact;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./engine/format.cjs"),t=require("./engine/chart.cjs"),n=require("./engine/presets.cjs"),r=require("./engine/shapes/chart.cjs"),i=require("./engine/shapes/canvas.cjs"),a=require("./engine/controller.cjs"),o=require("./engine/canvas.cjs");exports.createCanvasChart=o.createCanvasChart,exports.createCanvasShapeChart=i.createCanvasShapeChart,exports.createChart=t.createChart,exports.createChartController=a.createChartController,exports.createShapeChart=r.createShapeChart,exports.formatCompact=e.formatCompact,exports.heatmapChartOptions=n.heatmapChartOptions,exports.quadrantCenter=n.quadrantCenter,exports.quadrantChartOptions=n.quadrantChartOptions,exports.quadrantOf=n.quadrantOf,exports.scenePrimitives=a.scenePrimitives,exports.sparklineOptions=n.sparklineOptions;
|
package/dist/charts/core.d.cts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
export { createChart } from './engine/chart.cjs';
|
|
2
|
+
export { createShapeChart } from './engine/shapes/chart.cjs';
|
|
3
|
+
export { createCanvasShapeChart, type CanvasShapeChartConfig, type CanvasShapeChartInstance, } from './engine/shapes/canvas.cjs';
|
|
4
|
+
export type { FunnelChartOptions, GaugeBand, GaugeChartOptions, PieChartOptions, RadarChartOptions, RadarIndicator, RadarSeries, ShapeChartCommonOptions, ShapeChartEventMap, ShapeChartInstance, ShapeChartOptions, ShapeChartType, ShapeDatum, ShapeHoverEvent, ShapeLegendOptions, ShapeTooltipOptions, ShapeToggleEvent, TreemapChartOptions, TreemapNode, } from './engine/shapes/types.cjs';
|
|
5
|
+
export { createCanvasChart, type CanvasChartConfig, type CanvasChartInstance, type ChartCanvas, type ChartTouch, } from './engine/canvas.cjs';
|
|
6
|
+
export { createChartController, scenePrimitives, type ChartAreaPrimitive, type ChartBarPrimitive, type ChartController, type ChartControllerConfig, type ChartControllerEventMap, type ChartDotPrimitive, type ChartHoverLayout, type ChartLegendEntry, type ChartLegendLayout, type ChartLinePrimitive, type ChartPointerOptions, type ChartPrimitive, type ChartPrimitiveOptions, type ChartScene, type ChartTooltipLayout, } from './engine/controller.cjs';
|
|
2
7
|
export { formatCompact } from './engine/format.cjs';
|
|
3
|
-
export
|
|
8
|
+
export { heatmapChartOptions, quadrantCenter, quadrantChartOptions, quadrantOf, sparklineOptions, type HeatmapCell, type HeatmapConfig, type QuadrantAxisLabels, type QuadrantConfig, type QuadrantCorner, type QuadrantPoint, type QuadrantRegion, type QuadrantRegions, type SparklineConfig, } from './engine/presets.cjs';
|
|
9
|
+
export type { ChartThemeInput } from './engine/theme.cjs';
|
|
10
|
+
export type { ChartAnnotation, ChartAxisOptions, ChartAxisType, ChartColumnData, ChartCurve, ChartDragEvent, ChartEventMap, ChartHoverEvent, ChartHoverItem, ChartInstance, ChartInteractionOptions, ChartLabelPosition, ChartLegendOptions, ChartLineAnnotation, ChartOptions, ChartPadding, ChartPlotClickEvent, ChartPointDatum, ChartRect, ChartRectAnnotation, ChartRendererKind, ChartRendererPreference, ChartSeries, ChartSeriesData, ChartSeriesType, ChartTextAnnotation, ChartTooltipOptions, ChartView, ChartXValue, } from './engine/types.cjs';
|
package/dist/charts/core.d.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
export { createChart } from './engine/chart.js';
|
|
2
|
+
export { createShapeChart } from './engine/shapes/chart.js';
|
|
3
|
+
export { createCanvasShapeChart, type CanvasShapeChartConfig, type CanvasShapeChartInstance, } from './engine/shapes/canvas.js';
|
|
4
|
+
export type { FunnelChartOptions, GaugeBand, GaugeChartOptions, PieChartOptions, RadarChartOptions, RadarIndicator, RadarSeries, ShapeChartCommonOptions, ShapeChartEventMap, ShapeChartInstance, ShapeChartOptions, ShapeChartType, ShapeDatum, ShapeHoverEvent, ShapeLegendOptions, ShapeTooltipOptions, ShapeToggleEvent, TreemapChartOptions, TreemapNode, } from './engine/shapes/types.js';
|
|
5
|
+
export { createCanvasChart, type CanvasChartConfig, type CanvasChartInstance, type ChartCanvas, type ChartTouch, } from './engine/canvas.js';
|
|
6
|
+
export { createChartController, scenePrimitives, type ChartAreaPrimitive, type ChartBarPrimitive, type ChartController, type ChartControllerConfig, type ChartControllerEventMap, type ChartDotPrimitive, type ChartHoverLayout, type ChartLegendEntry, type ChartLegendLayout, type ChartLinePrimitive, type ChartPointerOptions, type ChartPrimitive, type ChartPrimitiveOptions, type ChartScene, type ChartTooltipLayout, } from './engine/controller.js';
|
|
2
7
|
export { formatCompact } from './engine/format.js';
|
|
3
|
-
export
|
|
8
|
+
export { heatmapChartOptions, quadrantCenter, quadrantChartOptions, quadrantOf, sparklineOptions, type HeatmapCell, type HeatmapConfig, type QuadrantAxisLabels, type QuadrantConfig, type QuadrantCorner, type QuadrantPoint, type QuadrantRegion, type QuadrantRegions, type SparklineConfig, } from './engine/presets.js';
|
|
9
|
+
export type { ChartThemeInput } from './engine/theme.js';
|
|
10
|
+
export type { ChartAnnotation, ChartAxisOptions, ChartAxisType, ChartColumnData, ChartCurve, ChartDragEvent, ChartEventMap, ChartHoverEvent, ChartHoverItem, ChartInstance, ChartInteractionOptions, ChartLabelPosition, ChartLegendOptions, ChartLineAnnotation, ChartOptions, ChartPadding, ChartPlotClickEvent, ChartPointDatum, ChartRect, ChartRectAnnotation, ChartRendererKind, ChartRendererPreference, ChartSeries, ChartSeriesData, ChartSeriesType, ChartTextAnnotation, ChartTooltipOptions, ChartView, ChartXValue, } from './engine/types.js';
|
package/dist/charts/core.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
import { formatCompact as e } from "./engine/format.js";
|
|
2
2
|
import { createChart as t } from "./engine/chart.js";
|
|
3
|
-
|
|
3
|
+
import { heatmapChartOptions as n, quadrantCenter as r, quadrantChartOptions as i, quadrantOf as a, sparklineOptions as o } from "./engine/presets.js";
|
|
4
|
+
import { createShapeChart as s } from "./engine/shapes/chart.js";
|
|
5
|
+
import { createCanvasShapeChart as c } from "./engine/shapes/canvas.js";
|
|
6
|
+
import { createChartController as l, scenePrimitives as u } from "./engine/controller.js";
|
|
7
|
+
import { createCanvasChart as d } from "./engine/canvas.js";
|
|
8
|
+
export { d as createCanvasChart, c as createCanvasShapeChart, t as createChart, l as createChartController, s as createShapeChart, e as formatCompact, n as heatmapChartOptions, r as quadrantCenter, i as quadrantChartOptions, a as quadrantOf, u as scenePrimitives, o as sparklineOptions };
|
|
@@ -0,0 +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=(t,i,a,o,c,l=r.createCanvas2dPainter(t))=>{let{width:u,height:d,theme:f,model:p,view:m,layout:h}=i,{plot:g,scales:_}=h,v=c;if(t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,Math.ceil(u*v),Math.ceil(d*v)),t.setTransform(v,0,0,v,0,0),n.drawBackground(t,{width:u,height:d,scales:_,x:p.x,y:p.y,xTicks:h.xTicks,yTicks:h.yTicks,theme:f,annotations:i.annotations}),i.legend){t.font=n.font(f,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(f.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(f.text,.06),t.fill());let y=(e,t,n)=>{let r=2/(e[1]-e[0]),i=(t-e[0])*r-1;return n?[-r,-i]:[r,i]},[b,x]=y(m.x,o.x,p.x.reverse),[S,C]=y(m.y,o.y,p.y.reverse);if(l.paint(a,{transform:{xScale:b,xOffset:x,yScale:S,yOffset:C},width:Math.max(1,Math.round(g.width*v)),height:Math.max(1,Math.round(g.height*v)),dpr:v},Math.round(g.x*v),Math.round(g.y*v)),t.setTransform(v,0,0,v,0,0),n.drawForeground(t,{width:u,height:d,scales:_,theme:f,annotations:i.annotations,pointLabels:[],clear:!1}),i.pointLabels.length){t.save(),t.font=n.font(f),t.textAlign=`left`,t.textBaseline=`middle`,t.lineWidth=3,t.lineJoin=`round`,t.strokeStyle=e.toCss(f.background,.9),t.fillStyle=e.toCss(f.text,.85);for(let{label:e,box:n}of i.pointLabels)t.strokeText(e.text,n.x,n.y+n.height/2),t.fillText(e.text,n.x,n.y+n.height/2);t.restore()}let w=i.hover;if(w){if(w.crosshairX!==null){t.save(),t.strokeStyle=e.toCss(f.textMuted,.55),t.lineWidth=1,t.setLineDash([3,3]),t.beginPath();let n=Math.round(w.crosshairX)+.5;t.moveTo(n,g.y),t.lineTo(n,g.y+g.height),t.stroke(),t.restore()}for(let n of w.marks)if(n.kind!==`band`){if(n.kind===`cell`){s(t,n.x,n.y,n.width,n.height,3),t.lineWidth=3,t.strokeStyle=e.toCss(f.background),t.stroke(),t.lineWidth=1.5,t.strokeStyle=e.toCss(f.text,.55),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(f.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(f.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(f.background),t.fill(),t.restore(),s(t,r.x+.5,r.y+.5,r.width-1,r.height-1,8),t.strokeStyle=e.toCss(f.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(f,12),t.fillStyle=e.toCss(f.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(f,12,600),t.fillStyle=e.toCss(f.text),t.textAlign=`left`,t.fillText(r.title,a,o),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+=14),t.font=n.font(f,12),t.textAlign=`left`,t.fillStyle=e.toCss(f.textMuted),t.fillText(s.name,a,o),t.font=n.font(f,12,600),t.textAlign=`right`,t.fillStyle=e.toCss(f.text),t.fillText(s.value,l,o),o+=i}}},l=e=>{let{canvas:n}=e,s=n.getContext(`2d`),l=e.width,u=e.height,d=e.pixelRatio??1,f=!1,p=null,m=[],h=null,g=``,_=e.options,v=new WeakMap,y=0,b=e=>{let t=v.get(e);return t===void 0&&v.set(e,t=++y),t},x={x:0,y:0},S=0,C=``,w=(e,t)=>s?(t!==C&&(s.font=t,C=t),s.measureText(e).width):e.length*6.5,T=s?r.createCanvas2dPainter(s):null,E=globalThis,D=()=>{if(p=null,f||!s||!T)return;let e=k.getScene();if(!e)return;let r=Math.max(1,Math.round(l*d)),a=Math.max(1,Math.round(u*d));if(n.width!==r&&(n.width=r),n.height!==a&&(n.height=a),C=``,h!==e.model){h=e.model;let n=i.itemsSignature(e.model,b(e.theme),e=>_.series[e]?.stack);n!==g&&(g=n,x={x:o(e.model.base.x),y:o(e.model.base.y)},m=t.buildItems(e.model,x,++S))}c(s,e,m,x,d,T),C=``},O=()=>{f||p!==null||(p=n.requestAnimationFrame?n.requestAnimationFrame(D):E.requestAnimationFrame?E.requestAnimationFrame(D):setTimeout(D,16))},k=a.createChartController({options:e.options,theme:e.theme,measureText:w,onInvalidate:O});k.setSize(l,u);let A=(e,t)=>({id:e.identifier??t,touch:!0});return{setOptions:e=>{_=e,k.setOptions(e)},setTheme:e=>k.setTheme(e),resize(e,t,n){l=e,u=t,n&&(d=n),k.setSize(e,t),O()},render(){p!==null&&(n.cancelAnimationFrame?n.cancelAnimationFrame(p):E.cancelAnimationFrame?E.cancelAnimationFrame(p):clearTimeout(p)),D()},touchStart(e){e.forEach((e,t)=>k.pointerDown(e.x,e.y,A(e,t)))},touchMove(e){e.forEach((e,t)=>k.pointerMove(e.x,e.y,A(e,t)))},touchEnd(e){e.forEach((e,t)=>k.pointerUp(e.x,e.y,A(e,t)))},touchCancel(e=[{x:0,y:0}]){e.forEach((e,t)=>k.pointerCancel(A(e,t)))},pointerDown:(e,t,n)=>k.pointerDown(e,t,n),pointerMove:(e,t,n)=>k.pointerMove(e,t,n),pointerUp:(e,t,n)=>k.pointerUp(e,t,n),pointerLeave:()=>k.pointerLeave(),zoomAt:(e,t,n)=>k.zoomAt(e,t,n),resetZoom:()=>k.resetZoom(),getView:()=>k.getView(),setView:e=>k.setView(e),toggleSeries:e=>k.toggleSeries(e),clearHover:()=>k.clearHover(),getPlotRect:()=>k.getPlotRect(),toPixel:(e,t)=>k.toPixel(e,t),fromPixel:(e,t)=>k.fromPixel(e,t),getController:()=>k,on:(e,t)=>k.on(e,t),destroy(){f||(f=!0,p!==null&&(n.cancelAnimationFrame?n.cancelAnimationFrame(p):E.cancelAnimationFrame?E.cancelAnimationFrame(p):clearTimeout(p)),T?.destroy(),k.destroy())}}};exports.createCanvasChart=l,exports.drawScene=c;
|
|
2
|
+
//# sourceMappingURL=canvas.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canvas.cjs","names":["createCanvas2dPainter","font","toCss","itemsSignature","buildItems","createChartController","require_color","require_items","require_overlay","require_canvas2d","require_signature","require_controller","mid","r","roundedRect","ctx","x","y","w","h","drawScene","scene","layout","dpr","pixelRatio","width","height","model","theme","e","cy","mark","scale","s","range","offset","o","reverse","xScale","xOffset","view","origin","yScale","yOffset","painter","items","plot","label","box","hover","cx","d","tip","padding","lineHeight","left","right","line","content","row","createCanvasChart","config","canvas","destroyed","frameId","itemsModel","itemsKey","options","themeIds","themeCount","themeId","id","version","fontSet","measureText","f","text","g","render","controller","pw","ph","key","index","schedule","touchOptions","t","i","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 type ChartController,\n type ChartControllerEventMap,\n type ChartPointerOptions,\n type ChartScene,\n} from \"./controller\";\nimport { buildItems, 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/** 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 theme,\n annotations: scene.annotations,\n });\n\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\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 ctx.setTransform(dpr, 0, 0, dpr, 0, 0);\n drawForeground(ctx, {\n width,\n height,\n scales,\n theme,\n annotations: scene.annotations,\n pointLabels: [],\n clear: false,\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 ctx.strokeText(label.text, box.x, box.y + box.height / 2);\n ctx.fillText(label.text, box.x, box.y + box.height / 2);\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 for (const mark of hover.marks) {\n if (mark.kind === \"band\") continue;\n if (mark.kind === \"cell\") {\n roundedRect(ctx, mark.x, mark.y, mark.width, mark.height, 3);\n ctx.lineWidth = 3;\n ctx.strokeStyle = toCss(theme.background);\n ctx.stroke();\n ctx.lineWidth = 1.5;\n ctx.strokeStyle = toCss(theme.text, 0.55);\n ctx.stroke();\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 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 x += 14;\n }\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 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 const key = itemsSignature(\n scene.model,\n themeId(scene.theme),\n (index) => options.series[index]?.stack,\n );\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);\n }\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":"oLA6FA,IAAMY,EAAO,IAAyBC,EAA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G,EAAG,IAAMR,EAAW,YAAY/D,EAAGC,EAAGmB,CAAC,EACxD,aAAc,EAAG,EAAG,IAAM2C,EAAW,YAAY/D,EAAGC,EAAGmB,CAAC,EACxD,WAAY,EAAG,EAAG,IAAM2C,EAAW,UAAU/D,EAAGC,EAAGmB,CAAC,EACpD,iBAAoB2C,EAAW,aAAa,EAC5C,QAAS,EAAG,EAAG,IAAMA,EAAW,OAAO/D,EAAGC,EAAG0D,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,QAAQ/D,EAAGC,CAAC,EAC1C,WAAY,EAAG,IAAM8D,EAAW,UAAU/D,EAAGC,CAAC,EAC9C,kBAAqB8D,EACrB,IAAK,EAAM,IAAaA,EAAW,GAAGY,EAAMC,CAAQ,EACpD,SAAU,CACJ7B,IACJ,EAAY,GACRC,IAAY,OACVF,EAAO,qBAAsBA,EAAO,qBAAqBE,CAAO,EAC3Da,EAAE,qBAAsBA,EAAE,qBAAqBb,CAAO,EAC1D,aAAaA,CAAO,GAE3BpB,GAAS,QAAQ,EACjBmC,EAAW,QAAQ,EACrB,CACF,CACF"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { ChartController, ChartControllerEventMap, ChartPointerOptions, ChartScene } from './controller.cjs';
|
|
2
|
+
import { Origin } from './items.cjs';
|
|
3
|
+
import { RenderItem } from './renderers/types.cjs';
|
|
4
|
+
import { ChartThemeInput } from './theme.cjs';
|
|
5
|
+
import { ChartOptions, ChartRect, ChartView } from './types.cjs';
|
|
6
|
+
/**
|
|
7
|
+
* The canvas a chart draws on: a browser `HTMLCanvasElement`, an
|
|
8
|
+
* `OffscreenCanvas` or the node of a mini-program `<canvas type="2d">`
|
|
9
|
+
* (`SelectorQuery.fields({ node: true })`)
|
|
10
|
+
*/
|
|
11
|
+
export interface ChartCanvas {
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
getContext(type: "2d"): unknown;
|
|
15
|
+
/** Mini-program canvases schedule their frames themselves */
|
|
16
|
+
requestAnimationFrame?: (callback: () => void) => number;
|
|
17
|
+
cancelAnimationFrame?: (id: number) => void;
|
|
18
|
+
}
|
|
19
|
+
/** A touch point relative to the canvas (`x` / `y`) with its identifier */
|
|
20
|
+
export interface ChartTouch {
|
|
21
|
+
x: number;
|
|
22
|
+
y: number;
|
|
23
|
+
identifier?: number;
|
|
24
|
+
}
|
|
25
|
+
export interface CanvasChartConfig {
|
|
26
|
+
canvas: ChartCanvas;
|
|
27
|
+
/** Size of the canvas in CSS pixels (rpx converted by the host) */
|
|
28
|
+
width: number;
|
|
29
|
+
height: number;
|
|
30
|
+
/**
|
|
31
|
+
* Device pixel ratio (`wx.getWindowInfo().pixelRatio` in mini-programs)
|
|
32
|
+
* @default 1
|
|
33
|
+
*/
|
|
34
|
+
pixelRatio?: number;
|
|
35
|
+
options: ChartOptions;
|
|
36
|
+
/** Colors and fonts: values of the Minerva CSS variables */
|
|
37
|
+
theme?: ChartThemeInput;
|
|
38
|
+
}
|
|
39
|
+
export interface CanvasChartInstance {
|
|
40
|
+
setOptions(options: ChartOptions): void;
|
|
41
|
+
setTheme(theme: ChartThemeInput | undefined): void;
|
|
42
|
+
/** New CSS size (and pixel ratio) of the canvas */
|
|
43
|
+
resize(width: number, height: number, pixelRatio?: number): void;
|
|
44
|
+
/** Draws now (frames are otherwise scheduled automatically) */
|
|
45
|
+
render(): void;
|
|
46
|
+
/** Touch handlers: pass the `touches` / `changedTouches` of the event */
|
|
47
|
+
touchStart(touches: readonly ChartTouch[]): void;
|
|
48
|
+
touchMove(touches: readonly ChartTouch[]): void;
|
|
49
|
+
touchEnd(changedTouches: readonly ChartTouch[]): void;
|
|
50
|
+
touchCancel(changedTouches?: readonly ChartTouch[]): void;
|
|
51
|
+
/** Mouse / pen handlers (H5, desktop mini-programs) */
|
|
52
|
+
pointerDown(x: number, y: number, options?: ChartPointerOptions): void;
|
|
53
|
+
pointerMove(x: number, y: number, options?: ChartPointerOptions): void;
|
|
54
|
+
pointerUp(x: number, y: number, options?: ChartPointerOptions): void;
|
|
55
|
+
pointerLeave(): void;
|
|
56
|
+
/** Zooms around a pixel (factor < 1 zooms in) */
|
|
57
|
+
zoomAt(x: number, y: number, factor: number): void;
|
|
58
|
+
resetZoom(): void;
|
|
59
|
+
getView(): ChartView;
|
|
60
|
+
setView(view: Partial<ChartView>): void;
|
|
61
|
+
toggleSeries(id: string): void;
|
|
62
|
+
clearHover(): void;
|
|
63
|
+
getPlotRect(): ChartRect | null;
|
|
64
|
+
toPixel(x: number, y: number): {
|
|
65
|
+
x: number;
|
|
66
|
+
y: number;
|
|
67
|
+
} | null;
|
|
68
|
+
fromPixel(x: number, y: number): {
|
|
69
|
+
x: number;
|
|
70
|
+
y: number;
|
|
71
|
+
} | null;
|
|
72
|
+
/** The platform-free controller (scene, gestures) */
|
|
73
|
+
getController(): ChartController;
|
|
74
|
+
on<K extends keyof ChartControllerEventMap>(type: K, listener: (event: ChartControllerEventMap[K]) => void): () => void;
|
|
75
|
+
destroy(): void;
|
|
76
|
+
}
|
|
77
|
+
/** Draws a scene (legend, axes, data, labels, hover) on a 2D context */
|
|
78
|
+
export declare const drawScene: (ctx: CanvasRenderingContext2D, scene: ChartScene, items: readonly RenderItem[], origin: Origin, pixelRatio: number, painter?: import('./renderers/canvas2d.cjs').Canvas2dPainter) => void;
|
|
79
|
+
/**
|
|
80
|
+
* Creates a chart drawn on a 2D canvas: line, area, bar and scatter series,
|
|
81
|
+
* annotations, legend and tooltip, tap / drag / pinch gestures. Works
|
|
82
|
+
* without a DOM (mini-programs); see `createChart` for the GPU version of
|
|
83
|
+
* the web.
|
|
84
|
+
*/
|
|
85
|
+
export declare const createCanvasChart: (config: CanvasChartConfig) => CanvasChartInstance;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { ChartController, ChartControllerEventMap, ChartPointerOptions, ChartScene } from './controller.js';
|
|
2
|
+
import { Origin } from './items.js';
|
|
3
|
+
import { RenderItem } from './renderers/types.js';
|
|
4
|
+
import { ChartThemeInput } from './theme.js';
|
|
5
|
+
import { ChartOptions, ChartRect, ChartView } from './types.js';
|
|
6
|
+
/**
|
|
7
|
+
* The canvas a chart draws on: a browser `HTMLCanvasElement`, an
|
|
8
|
+
* `OffscreenCanvas` or the node of a mini-program `<canvas type="2d">`
|
|
9
|
+
* (`SelectorQuery.fields({ node: true })`)
|
|
10
|
+
*/
|
|
11
|
+
export interface ChartCanvas {
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
getContext(type: "2d"): unknown;
|
|
15
|
+
/** Mini-program canvases schedule their frames themselves */
|
|
16
|
+
requestAnimationFrame?: (callback: () => void) => number;
|
|
17
|
+
cancelAnimationFrame?: (id: number) => void;
|
|
18
|
+
}
|
|
19
|
+
/** A touch point relative to the canvas (`x` / `y`) with its identifier */
|
|
20
|
+
export interface ChartTouch {
|
|
21
|
+
x: number;
|
|
22
|
+
y: number;
|
|
23
|
+
identifier?: number;
|
|
24
|
+
}
|
|
25
|
+
export interface CanvasChartConfig {
|
|
26
|
+
canvas: ChartCanvas;
|
|
27
|
+
/** Size of the canvas in CSS pixels (rpx converted by the host) */
|
|
28
|
+
width: number;
|
|
29
|
+
height: number;
|
|
30
|
+
/**
|
|
31
|
+
* Device pixel ratio (`wx.getWindowInfo().pixelRatio` in mini-programs)
|
|
32
|
+
* @default 1
|
|
33
|
+
*/
|
|
34
|
+
pixelRatio?: number;
|
|
35
|
+
options: ChartOptions;
|
|
36
|
+
/** Colors and fonts: values of the Minerva CSS variables */
|
|
37
|
+
theme?: ChartThemeInput;
|
|
38
|
+
}
|
|
39
|
+
export interface CanvasChartInstance {
|
|
40
|
+
setOptions(options: ChartOptions): void;
|
|
41
|
+
setTheme(theme: ChartThemeInput | undefined): void;
|
|
42
|
+
/** New CSS size (and pixel ratio) of the canvas */
|
|
43
|
+
resize(width: number, height: number, pixelRatio?: number): void;
|
|
44
|
+
/** Draws now (frames are otherwise scheduled automatically) */
|
|
45
|
+
render(): void;
|
|
46
|
+
/** Touch handlers: pass the `touches` / `changedTouches` of the event */
|
|
47
|
+
touchStart(touches: readonly ChartTouch[]): void;
|
|
48
|
+
touchMove(touches: readonly ChartTouch[]): void;
|
|
49
|
+
touchEnd(changedTouches: readonly ChartTouch[]): void;
|
|
50
|
+
touchCancel(changedTouches?: readonly ChartTouch[]): void;
|
|
51
|
+
/** Mouse / pen handlers (H5, desktop mini-programs) */
|
|
52
|
+
pointerDown(x: number, y: number, options?: ChartPointerOptions): void;
|
|
53
|
+
pointerMove(x: number, y: number, options?: ChartPointerOptions): void;
|
|
54
|
+
pointerUp(x: number, y: number, options?: ChartPointerOptions): void;
|
|
55
|
+
pointerLeave(): void;
|
|
56
|
+
/** Zooms around a pixel (factor < 1 zooms in) */
|
|
57
|
+
zoomAt(x: number, y: number, factor: number): void;
|
|
58
|
+
resetZoom(): void;
|
|
59
|
+
getView(): ChartView;
|
|
60
|
+
setView(view: Partial<ChartView>): void;
|
|
61
|
+
toggleSeries(id: string): void;
|
|
62
|
+
clearHover(): void;
|
|
63
|
+
getPlotRect(): ChartRect | null;
|
|
64
|
+
toPixel(x: number, y: number): {
|
|
65
|
+
x: number;
|
|
66
|
+
y: number;
|
|
67
|
+
} | null;
|
|
68
|
+
fromPixel(x: number, y: number): {
|
|
69
|
+
x: number;
|
|
70
|
+
y: number;
|
|
71
|
+
} | null;
|
|
72
|
+
/** The platform-free controller (scene, gestures) */
|
|
73
|
+
getController(): ChartController;
|
|
74
|
+
on<K extends keyof ChartControllerEventMap>(type: K, listener: (event: ChartControllerEventMap[K]) => void): () => void;
|
|
75
|
+
destroy(): void;
|
|
76
|
+
}
|
|
77
|
+
/** Draws a scene (legend, axes, data, labels, hover) on a 2D context */
|
|
78
|
+
export declare const drawScene: (ctx: CanvasRenderingContext2D, scene: ChartScene, items: readonly RenderItem[], origin: Origin, pixelRatio: number, painter?: import('./renderers/canvas2d.js').Canvas2dPainter) => void;
|
|
79
|
+
/**
|
|
80
|
+
* Creates a chart drawn on a 2D canvas: line, area, bar and scatter series,
|
|
81
|
+
* annotations, legend and tooltip, tap / drag / pinch gestures. Works
|
|
82
|
+
* without a DOM (mini-programs); see `createChart` for the GPU version of
|
|
83
|
+
* the web.
|
|
84
|
+
*/
|
|
85
|
+
export declare const createCanvasChart: (config: CanvasChartConfig) => CanvasChartInstance;
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { toCss as e } from "./color.js";
|
|
2
|
+
import { buildItems as t } from "./items.js";
|
|
3
|
+
import { drawBackground as n, drawForeground as r, font as i } from "./overlay.js";
|
|
4
|
+
import { createCanvas2dPainter as a } from "./renderers/canvas2d.js";
|
|
5
|
+
import { itemsSignature as o } from "./signature.js";
|
|
6
|
+
import { createChartController as s } from "./controller.js";
|
|
7
|
+
//#region src/engine/canvas.ts
|
|
8
|
+
var c = (e) => (e[0] + e[1]) / 2, l = (e, t, n, r, i, a) => {
|
|
9
|
+
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();
|
|
10
|
+
}, u = (t, o, s, c, u, d = a(t)) => {
|
|
11
|
+
let { width: f, height: p, theme: m, model: h, view: g, layout: _ } = o, { plot: v, scales: y } = _, b = u;
|
|
12
|
+
if (t.setTransform(1, 0, 0, 1, 0, 0), t.clearRect(0, 0, Math.ceil(f * b), Math.ceil(p * b)), t.setTransform(b, 0, 0, b, 0, 0), n(t, {
|
|
13
|
+
width: f,
|
|
14
|
+
height: p,
|
|
15
|
+
scales: y,
|
|
16
|
+
x: h.x,
|
|
17
|
+
y: h.y,
|
|
18
|
+
xTicks: _.xTicks,
|
|
19
|
+
yTicks: _.yTicks,
|
|
20
|
+
theme: m,
|
|
21
|
+
annotations: o.annotations
|
|
22
|
+
}), o.legend) {
|
|
23
|
+
t.font = i(m, 12), t.textBaseline = "middle", t.textAlign = "left";
|
|
24
|
+
for (let n of o.legend.entries) {
|
|
25
|
+
let r = n.box.y + n.box.height / 2;
|
|
26
|
+
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(m.textMuted), t.fillText(n.name, n.box.x + 14, r), n.hidden) {
|
|
27
|
+
let e = n.box.width - 22;
|
|
28
|
+
t.fillRect(n.box.x + 14, r, e, 1);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
t.globalAlpha = 1;
|
|
32
|
+
}
|
|
33
|
+
for (let n of o.hover?.marks ?? []) n.kind === "band" && (l(t, n.x, n.y, n.width, n.height, 6), t.fillStyle = e(m.text, .06), t.fill());
|
|
34
|
+
let x = (e, t, n) => {
|
|
35
|
+
let r = 2 / (e[1] - e[0]), i = (t - e[0]) * r - 1;
|
|
36
|
+
return n ? [-r, -i] : [r, i];
|
|
37
|
+
}, [S, C] = x(g.x, c.x, h.x.reverse), [w, T] = x(g.y, c.y, h.y.reverse);
|
|
38
|
+
if (d.paint(s, {
|
|
39
|
+
transform: {
|
|
40
|
+
xScale: S,
|
|
41
|
+
xOffset: C,
|
|
42
|
+
yScale: w,
|
|
43
|
+
yOffset: T
|
|
44
|
+
},
|
|
45
|
+
width: Math.max(1, Math.round(v.width * b)),
|
|
46
|
+
height: Math.max(1, Math.round(v.height * b)),
|
|
47
|
+
dpr: b
|
|
48
|
+
}, Math.round(v.x * b), Math.round(v.y * b)), t.setTransform(b, 0, 0, b, 0, 0), r(t, {
|
|
49
|
+
width: f,
|
|
50
|
+
height: p,
|
|
51
|
+
scales: y,
|
|
52
|
+
theme: m,
|
|
53
|
+
annotations: o.annotations,
|
|
54
|
+
pointLabels: [],
|
|
55
|
+
clear: !1
|
|
56
|
+
}), o.pointLabels.length) {
|
|
57
|
+
t.save(), t.font = i(m), t.textAlign = "left", t.textBaseline = "middle", t.lineWidth = 3, t.lineJoin = "round", t.strokeStyle = e(m.background, .9), t.fillStyle = e(m.text, .85);
|
|
58
|
+
for (let { label: e, box: n } of o.pointLabels) t.strokeText(e.text, n.x, n.y + n.height / 2), t.fillText(e.text, n.x, n.y + n.height / 2);
|
|
59
|
+
t.restore();
|
|
60
|
+
}
|
|
61
|
+
let E = o.hover;
|
|
62
|
+
if (E) {
|
|
63
|
+
if (E.crosshairX !== null) {
|
|
64
|
+
t.save(), t.strokeStyle = e(m.textMuted, .55), t.lineWidth = 1, t.setLineDash([3, 3]), t.beginPath();
|
|
65
|
+
let n = Math.round(E.crosshairX) + .5;
|
|
66
|
+
t.moveTo(n, v.y), t.lineTo(n, v.y + v.height), t.stroke(), t.restore();
|
|
67
|
+
}
|
|
68
|
+
for (let n of E.marks) if (n.kind !== "band") {
|
|
69
|
+
if (n.kind === "cell") {
|
|
70
|
+
l(t, n.x, n.y, n.width, n.height, 3), t.lineWidth = 3, t.strokeStyle = e(m.background), t.stroke(), t.lineWidth = 1.5, t.strokeStyle = e(m.text, .55), t.stroke();
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
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(m.background), t.stroke();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
if (o.dragging) {
|
|
77
|
+
let n = o.dragging;
|
|
78
|
+
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(m.background), t.stroke();
|
|
79
|
+
}
|
|
80
|
+
let D = E?.tooltip;
|
|
81
|
+
if (D) {
|
|
82
|
+
let { box: n, lineHeight: r, padding: a } = D;
|
|
83
|
+
t.save(), t.shadowColor = "rgba(15, 23, 42, 0.18)", t.shadowBlur = 16, t.shadowOffsetY = 6, l(t, n.x, n.y, n.width, n.height, 8), t.fillStyle = e(m.background), t.fill(), t.restore(), l(t, n.x + .5, n.y + .5, n.width - 1, n.height - 1, 8), t.strokeStyle = e(m.axis, .6), t.lineWidth = 1, t.stroke(), t.textBaseline = "middle";
|
|
84
|
+
let o = n.y + a + r / 2, s = n.x + a + 2, c = n.x + n.width - a - 2;
|
|
85
|
+
if (D.text) {
|
|
86
|
+
t.font = i(m, 12), t.fillStyle = e(m.text), t.textAlign = "left";
|
|
87
|
+
for (let e of D.text) t.fillText(e, s, o), o += r;
|
|
88
|
+
} else {
|
|
89
|
+
let { content: n } = D, a = s;
|
|
90
|
+
n.titleColor && (t.fillStyle = n.titleColor, t.beginPath(), t.arc(a + 4, o, 4, 0, Math.PI * 2), t.fill(), a += 14), t.font = i(m, 12, 600), t.fillStyle = e(m.text), t.textAlign = "left", t.fillText(n.title, a, o), o += r;
|
|
91
|
+
for (let l of n.rows) a = s, l.color && (t.fillStyle = l.color, t.beginPath(), t.arc(a + 4, o, 4, 0, Math.PI * 2), t.fill(), a += 14), t.font = i(m, 12), t.textAlign = "left", t.fillStyle = e(m.textMuted), t.fillText(l.name, a, o), t.font = i(m, 12, 600), t.textAlign = "right", t.fillStyle = e(m.text), t.fillText(l.value, c, o), o += r;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}, d = (e) => {
|
|
95
|
+
let { canvas: n } = e, r = n.getContext("2d"), i = e.width, l = e.height, d = e.pixelRatio ?? 1, f = !1, p = null, m = [], h = null, g = "", _ = e.options, v = /* @__PURE__ */ new WeakMap(), y = 0, b = (e) => {
|
|
96
|
+
let t = v.get(e);
|
|
97
|
+
return t === void 0 && v.set(e, t = ++y), t;
|
|
98
|
+
}, x = {
|
|
99
|
+
x: 0,
|
|
100
|
+
y: 0
|
|
101
|
+
}, S = 0, C = "", w = (e, t) => r ? (t !== C && (r.font = t, C = t), r.measureText(e).width) : e.length * 6.5, T = r ? a(r) : null, E = globalThis, D = () => {
|
|
102
|
+
if (p = null, f || !r || !T) return;
|
|
103
|
+
let e = k.getScene();
|
|
104
|
+
if (!e) return;
|
|
105
|
+
let a = Math.max(1, Math.round(i * d)), s = Math.max(1, Math.round(l * d));
|
|
106
|
+
if (n.width !== a && (n.width = a), n.height !== s && (n.height = s), C = "", h !== e.model) {
|
|
107
|
+
h = e.model;
|
|
108
|
+
let n = o(e.model, b(e.theme), (e) => _.series[e]?.stack);
|
|
109
|
+
n !== g && (g = n, x = {
|
|
110
|
+
x: c(e.model.base.x),
|
|
111
|
+
y: c(e.model.base.y)
|
|
112
|
+
}, m = t(e.model, x, ++S));
|
|
113
|
+
}
|
|
114
|
+
u(r, e, m, x, d, T), C = "";
|
|
115
|
+
}, O = () => {
|
|
116
|
+
f || p !== null || (p = n.requestAnimationFrame ? n.requestAnimationFrame(D) : E.requestAnimationFrame ? E.requestAnimationFrame(D) : setTimeout(D, 16));
|
|
117
|
+
}, k = s({
|
|
118
|
+
options: e.options,
|
|
119
|
+
theme: e.theme,
|
|
120
|
+
measureText: w,
|
|
121
|
+
onInvalidate: O
|
|
122
|
+
});
|
|
123
|
+
k.setSize(i, l);
|
|
124
|
+
let A = (e, t) => ({
|
|
125
|
+
id: e.identifier ?? t,
|
|
126
|
+
touch: !0
|
|
127
|
+
});
|
|
128
|
+
return {
|
|
129
|
+
setOptions: (e) => {
|
|
130
|
+
_ = e, k.setOptions(e);
|
|
131
|
+
},
|
|
132
|
+
setTheme: (e) => k.setTheme(e),
|
|
133
|
+
resize(e, t, n) {
|
|
134
|
+
i = e, l = t, n && (d = n), k.setSize(e, t), O();
|
|
135
|
+
},
|
|
136
|
+
render() {
|
|
137
|
+
p !== null && (n.cancelAnimationFrame ? n.cancelAnimationFrame(p) : E.cancelAnimationFrame ? E.cancelAnimationFrame(p) : clearTimeout(p)), D();
|
|
138
|
+
},
|
|
139
|
+
touchStart(e) {
|
|
140
|
+
e.forEach((e, t) => k.pointerDown(e.x, e.y, A(e, t)));
|
|
141
|
+
},
|
|
142
|
+
touchMove(e) {
|
|
143
|
+
e.forEach((e, t) => k.pointerMove(e.x, e.y, A(e, t)));
|
|
144
|
+
},
|
|
145
|
+
touchEnd(e) {
|
|
146
|
+
e.forEach((e, t) => k.pointerUp(e.x, e.y, A(e, t)));
|
|
147
|
+
},
|
|
148
|
+
touchCancel(e = [{
|
|
149
|
+
x: 0,
|
|
150
|
+
y: 0
|
|
151
|
+
}]) {
|
|
152
|
+
e.forEach((e, t) => k.pointerCancel(A(e, t)));
|
|
153
|
+
},
|
|
154
|
+
pointerDown: (e, t, n) => k.pointerDown(e, t, n),
|
|
155
|
+
pointerMove: (e, t, n) => k.pointerMove(e, t, n),
|
|
156
|
+
pointerUp: (e, t, n) => k.pointerUp(e, t, n),
|
|
157
|
+
pointerLeave: () => k.pointerLeave(),
|
|
158
|
+
zoomAt: (e, t, n) => k.zoomAt(e, t, n),
|
|
159
|
+
resetZoom: () => k.resetZoom(),
|
|
160
|
+
getView: () => k.getView(),
|
|
161
|
+
setView: (e) => k.setView(e),
|
|
162
|
+
toggleSeries: (e) => k.toggleSeries(e),
|
|
163
|
+
clearHover: () => k.clearHover(),
|
|
164
|
+
getPlotRect: () => k.getPlotRect(),
|
|
165
|
+
toPixel: (e, t) => k.toPixel(e, t),
|
|
166
|
+
fromPixel: (e, t) => k.fromPixel(e, t),
|
|
167
|
+
getController: () => k,
|
|
168
|
+
on: (e, t) => k.on(e, t),
|
|
169
|
+
destroy() {
|
|
170
|
+
f || (f = !0, p !== null && (n.cancelAnimationFrame ? n.cancelAnimationFrame(p) : E.cancelAnimationFrame ? E.cancelAnimationFrame(p) : clearTimeout(p)), T?.destroy(), k.destroy());
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
//#endregion
|
|
175
|
+
export { d as createCanvasChart, u as drawScene };
|
|
176
|
+
|
|
177
|
+
//# sourceMappingURL=canvas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canvas.js","names":["mid","r","roundedRect","ctx","x","y","w","h","drawScene","createCanvas2dPainter","scene","layout","dpr","pixelRatio","width","height","drawBackground","model","font","theme","e","cy","toCss","mark","scale","s","range","offset","o","reverse","xScale","xOffset","view","origin","yScale","yOffset","painter","items","plot","drawForeground","label","box","hover","cx","d","tip","padding","lineHeight","left","right","line","content","row","createCanvasChart","config","canvas","destroyed","frameId","itemsModel","itemsKey","options","themeIds","themeCount","themeId","id","version","fontSet","measureText","f","text","g","render","controller","pw","ph","key","itemsSignature","index","buildItems","schedule","createChartController","touchOptions","t","i","ratio","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 type ChartController,\n type ChartControllerEventMap,\n type ChartPointerOptions,\n type ChartScene,\n} from \"./controller\";\nimport { buildItems, 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/** 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 theme,\n annotations: scene.annotations,\n });\n\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\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 ctx.setTransform(dpr, 0, 0, dpr, 0, 0);\n drawForeground(ctx, {\n width,\n height,\n scales,\n theme,\n annotations: scene.annotations,\n pointLabels: [],\n clear: false,\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 ctx.strokeText(label.text, box.x, box.y + box.height / 2);\n ctx.fillText(label.text, box.x, box.y + box.height / 2);\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 for (const mark of hover.marks) {\n if (mark.kind === \"band\") continue;\n if (mark.kind === \"cell\") {\n roundedRect(ctx, mark.x, mark.y, mark.width, mark.height, 3);\n ctx.lineWidth = 3;\n ctx.strokeStyle = toCss(theme.background);\n ctx.stroke();\n ctx.lineWidth = 1.5;\n ctx.strokeStyle = toCss(theme.text, 0.55);\n ctx.stroke();\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 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 x += 14;\n }\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 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 const key = itemsSignature(\n scene.model,\n themeId(scene.theme),\n (index) => options.series[index]?.stack,\n );\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);\n }\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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