@d3plus/core 3.1.6 → 4.1.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/README.md +9924 -78528
- package/es/index.js +8 -0
- package/es/index.js.map +1 -1
- package/es/internal.js +54 -0
- package/es/internal.js.map +1 -0
- package/es/src/charts/AreaPlot/index.js +36 -0
- package/es/src/charts/AreaPlot/index.js.map +1 -0
- package/es/src/charts/BarChart/index.js +48 -0
- package/es/src/charts/BarChart/index.js.map +1 -0
- package/es/src/charts/BoxWhisker/index.js +52 -0
- package/es/src/charts/BoxWhisker/index.js.map +1 -0
- package/es/src/charts/BumpChart/index.js +81 -0
- package/es/src/charts/BumpChart/index.js.map +1 -0
- package/es/src/charts/Donut/index.js +42 -0
- package/es/src/charts/Donut/index.js.map +1 -0
- package/es/src/charts/Geomap/applyLayout.js +208 -0
- package/es/src/charts/Geomap/applyLayout.js.map +1 -0
- package/es/src/charts/Geomap/emit.js +169 -0
- package/es/src/charts/Geomap/emit.js.map +1 -0
- package/es/src/charts/Geomap/index.js +521 -0
- package/es/src/charts/Geomap/index.js.map +1 -0
- package/es/src/charts/LinePlot/index.js +32 -0
- package/es/src/charts/LinePlot/index.js.map +1 -0
- package/es/src/charts/Matrix/applyLayout.js +92 -0
- package/es/src/charts/Matrix/applyLayout.js.map +1 -0
- package/es/src/charts/Matrix/emit.js +44 -0
- package/es/src/charts/Matrix/emit.js.map +1 -0
- package/es/src/charts/Matrix/index.js +154 -0
- package/es/src/charts/Matrix/index.js.map +1 -0
- package/es/src/charts/Network/applyLayout.js +322 -0
- package/es/src/charts/Network/applyLayout.js.map +1 -0
- package/es/src/charts/Network/emit.js +273 -0
- package/es/src/charts/Network/emit.js.map +1 -0
- package/es/src/charts/Network/index.js +422 -0
- package/es/src/charts/Network/index.js.map +1 -0
- package/es/src/charts/Pack/applyLayout.js +46 -0
- package/es/src/charts/Pack/applyLayout.js.map +1 -0
- package/es/src/charts/Pack/emit.js +116 -0
- package/es/src/charts/Pack/emit.js.map +1 -0
- package/es/src/charts/Pack/index.js +194 -0
- package/es/src/charts/Pack/index.js.map +1 -0
- package/es/src/charts/Pack/recursionCircles.js +18 -0
- package/es/src/charts/Pack/recursionCircles.js.map +1 -0
- package/es/src/charts/Pie/applyLayout.js +44 -0
- package/es/src/charts/Pie/applyLayout.js.map +1 -0
- package/es/src/charts/Pie/emit.js +111 -0
- package/es/src/charts/Pie/emit.js.map +1 -0
- package/es/src/charts/Pie/index.js +134 -0
- package/es/src/charts/Pie/index.js.map +1 -0
- package/es/src/charts/Plot/draw.js +424 -0
- package/es/src/charts/Plot/draw.js.map +1 -0
- package/es/src/charts/Plot/index.js +827 -0
- package/es/src/charts/Plot/index.js.map +1 -0
- package/es/src/charts/Plot/labelPlacement.js +36 -0
- package/es/src/charts/Plot/labelPlacement.js.map +1 -0
- package/es/src/charts/Plot/pipeline.js +594 -0
- package/es/src/charts/Plot/pipeline.js.map +1 -0
- package/es/src/charts/Plot/pipelineDomains.js +254 -0
- package/es/src/charts/Plot/pipelineDomains.js.map +1 -0
- package/es/src/charts/Plot/pipelineLineLabels.js +210 -0
- package/es/src/charts/Plot/pipelineLineLabels.js.map +1 -0
- package/es/src/charts/Plot/shapeDefaults.js +189 -0
- package/es/src/charts/Plot/shapeDefaults.js.map +1 -0
- package/es/src/charts/Plot/stackHelpers.js +52 -0
- package/es/src/charts/Plot/stackHelpers.js.map +1 -0
- package/es/src/charts/Priestley/applyLayout.js +121 -0
- package/es/src/charts/Priestley/applyLayout.js.map +1 -0
- package/es/src/charts/Priestley/emit.js +129 -0
- package/es/src/charts/Priestley/emit.js.map +1 -0
- package/es/src/charts/Priestley/index.js +97 -0
- package/es/src/charts/Priestley/index.js.map +1 -0
- package/es/src/charts/Radar/applyLayout.js +326 -0
- package/es/src/charts/Radar/applyLayout.js.map +1 -0
- package/es/src/charts/Radar/emit.js +28 -0
- package/es/src/charts/Radar/emit.js.map +1 -0
- package/es/src/charts/Radar/index.js +98 -0
- package/es/src/charts/Radar/index.js.map +1 -0
- package/es/src/charts/RadialMatrix/applyLayout.js +132 -0
- package/es/src/charts/RadialMatrix/applyLayout.js.map +1 -0
- package/es/src/charts/RadialMatrix/emit.js +33 -0
- package/es/src/charts/RadialMatrix/emit.js.map +1 -0
- package/es/src/charts/RadialMatrix/index.js +144 -0
- package/es/src/charts/RadialMatrix/index.js.map +1 -0
- package/es/src/charts/Rings/applyLayout.js +508 -0
- package/es/src/charts/Rings/applyLayout.js.map +1 -0
- package/es/src/charts/Rings/emit.js +222 -0
- package/es/src/charts/Rings/emit.js.map +1 -0
- package/es/src/charts/Rings/index.js +245 -0
- package/es/src/charts/Rings/index.js.map +1 -0
- package/es/src/charts/Sankey/applyLayout.js +107 -0
- package/es/src/charts/Sankey/applyLayout.js.map +1 -0
- package/es/src/charts/Sankey/emit.js +134 -0
- package/es/src/charts/Sankey/emit.js.map +1 -0
- package/es/src/charts/Sankey/index.js +219 -0
- package/es/src/charts/Sankey/index.js.map +1 -0
- package/es/src/charts/StackedArea/index.js +27 -0
- package/es/src/charts/StackedArea/index.js.map +1 -0
- package/es/src/charts/Tree/applyLayout.js +233 -0
- package/es/src/charts/Tree/applyLayout.js.map +1 -0
- package/es/src/charts/Tree/emit.js +257 -0
- package/es/src/charts/Tree/emit.js.map +1 -0
- package/es/src/charts/Tree/index.js +105 -0
- package/es/src/charts/Tree/index.js.map +1 -0
- package/es/src/charts/Treemap/applyLayout.js +85 -0
- package/es/src/charts/Treemap/applyLayout.js.map +1 -0
- package/es/src/charts/Treemap/emit.js +141 -0
- package/es/src/charts/Treemap/emit.js.map +1 -0
- package/es/src/charts/Treemap/index.js +177 -0
- package/es/src/charts/Treemap/index.js.map +1 -0
- package/es/src/charts/Treemap/thresholdFunction.js +112 -0
- package/es/src/charts/Treemap/thresholdFunction.js.map +1 -0
- package/es/src/charts/definition/ChartDefinition.js +12 -0
- package/es/src/charts/definition/ChartDefinition.js.map +1 -0
- package/es/src/charts/definition/applyDefinition.js +107 -0
- package/es/src/charts/definition/applyDefinition.js.map +1 -0
- package/es/src/charts/definition/makeChart.js +153 -0
- package/es/src/charts/definition/makeChart.js.map +1 -0
- package/es/src/charts/drawSteps/zoomControls.js +231 -96
- package/es/src/charts/drawSteps/zoomControls.js.map +1 -1
- package/es/src/charts/events/click.legend.js +2 -2
- package/es/src/charts/events/click.legend.js.map +1 -1
- package/es/src/charts/events/click.shape.js +5 -5
- package/es/src/charts/events/click.shape.js.map +1 -1
- package/es/src/charts/events/mouseenter.js +20 -1
- package/es/src/charts/events/mouseenter.js.map +1 -1
- package/es/src/charts/events/mouseleave.js +19 -4
- package/es/src/charts/events/mouseleave.js.map +1 -1
- package/es/src/charts/events/mousemove.legend.js +10 -10
- package/es/src/charts/events/mousemove.legend.js.map +1 -1
- package/es/src/charts/events/mousemove.shape.js +14 -8
- package/es/src/charts/events/mousemove.shape.js.map +1 -1
- package/es/src/charts/events/touchstart.body.js.map +1 -1
- package/es/src/charts/features/axes.js +432 -0
- package/es/src/charts/features/axes.js.map +1 -0
- package/es/src/charts/features/chartGeometry.js +66 -0
- package/es/src/charts/features/chartGeometry.js.map +1 -0
- package/es/src/charts/features/colorScaleBucket.js +92 -0
- package/es/src/charts/features/colorScaleBucket.js.map +1 -0
- package/es/src/charts/features/emitHelpers.js +217 -0
- package/es/src/charts/features/emitHelpers.js.map +1 -0
- package/es/src/charts/features/ensureZoomDom.js +71 -0
- package/es/src/charts/features/ensureZoomDom.js.map +1 -0
- package/es/src/charts/features/features.js +650 -0
- package/es/src/charts/features/features.js.map +1 -0
- package/es/src/charts/features/featuresLegend.js +180 -0
- package/es/src/charts/features/featuresLegend.js.map +1 -0
- package/es/src/charts/features/legendLabel.js +12 -0
- package/es/src/charts/features/legendLabel.js.map +1 -0
- package/es/src/charts/features/lineLabels.js +154 -0
- package/es/src/charts/features/lineLabels.js.map +1 -0
- package/es/src/charts/features/plotPaint.js +512 -0
- package/es/src/charts/features/plotPaint.js.map +1 -0
- package/es/src/charts/features/shapeEmit.js +273 -0
- package/es/src/charts/features/shapeEmit.js.map +1 -0
- package/es/src/charts/helpers/matrixData.js +3 -3
- package/es/src/charts/helpers/matrixData.js.map +1 -1
- package/es/src/charts/index.js +21 -21
- package/es/src/charts/index.js.map +1 -1
- package/es/src/charts/pipeline/resolveSpec.js +44 -0
- package/es/src/charts/pipeline/resolveSpec.js.map +1 -0
- package/es/src/charts/pipeline/runChartDraw.js +109 -0
- package/es/src/charts/pipeline/runChartDraw.js.map +1 -0
- package/es/src/charts/pipeline/runVizPipeline.js +84 -0
- package/es/src/charts/pipeline/runVizPipeline.js.map +1 -0
- package/es/src/charts/pipeline/stages.js +103 -0
- package/es/src/charts/pipeline/stages.js.map +1 -0
- package/es/src/charts/pipeline/vizContext.js +29 -0
- package/es/src/charts/pipeline/vizContext.js.map +1 -0
- package/es/src/charts/pipeline/vizDraw.js +37 -0
- package/es/src/charts/pipeline/vizDraw.js.map +1 -0
- package/es/src/charts/pipeline/vizDrawPure.js +174 -0
- package/es/src/charts/pipeline/vizDrawPure.js.map +1 -0
- package/es/src/charts/pipeline/vizPreDraw.js +145 -0
- package/es/src/charts/pipeline/vizPreDraw.js.map +1 -0
- package/es/src/charts/pipeline/vizPreDrawPure.js +279 -0
- package/es/src/charts/pipeline/vizPreDrawPure.js.map +1 -0
- package/es/src/charts/plotBuffers/Bar.js +4 -4
- package/es/src/charts/plotBuffers/Bar.js.map +1 -1
- package/es/src/charts/plotBuffers/Box.js +4 -4
- package/es/src/charts/plotBuffers/Box.js.map +1 -1
- package/es/src/charts/plotBuffers/Circle.js +2 -2
- package/es/src/charts/plotBuffers/Circle.js.map +1 -1
- package/es/src/charts/plotBuffers/Line.js +5 -5
- package/es/src/charts/plotBuffers/Line.js.map +1 -1
- package/es/src/charts/plotBuffers/Rect.js +2 -2
- package/es/src/charts/plotBuffers/Rect.js.map +1 -1
- package/es/src/charts/plotBuffers/discreteBuffer.js +1 -2
- package/es/src/charts/plotBuffers/discreteBuffer.js.map +1 -1
- package/es/src/charts/plotBuffers/numericBuffer.js +1 -2
- package/es/src/charts/plotBuffers/numericBuffer.js.map +1 -1
- package/es/src/charts/viz/Viz.js +985 -0
- package/es/src/charts/viz/Viz.js.map +1 -0
- package/es/src/charts/viz/VizBase.js +447 -0
- package/es/src/charts/viz/VizBase.js.map +1 -0
- package/es/src/charts/viz/VizBaseConfig.js +504 -0
- package/es/src/charts/viz/VizBaseConfig.js.map +1 -0
- package/es/src/charts/viz/interactionOpacity.js +247 -0
- package/es/src/charts/viz/interactionOpacity.js.map +1 -0
- package/es/src/charts/viz/ordinalColor.js +71 -0
- package/es/src/charts/viz/ordinalColor.js.map +1 -0
- package/es/src/charts/viz/trailCatchup.js +127 -0
- package/es/src/charts/viz/trailCatchup.js.map +1 -0
- package/es/src/charts/viz/vizDefaults.js +602 -0
- package/es/src/charts/viz/vizDefaults.js.map +1 -0
- package/es/src/charts/viz/vizRender.js +251 -0
- package/es/src/charts/viz/vizRender.js.map +1 -0
- package/es/src/charts/viz/vizTypes.js +28 -0
- package/es/src/charts/viz/vizTypes.js.map +1 -0
- package/es/src/components/Axis/Axis.js +691 -0
- package/es/src/components/Axis/Axis.js.map +1 -0
- package/es/src/components/Axis/AxisBottom.js.map +1 -0
- package/es/src/components/Axis/AxisLeft.js.map +1 -0
- package/es/src/components/Axis/AxisRight.js.map +1 -0
- package/es/src/components/Axis/AxisTop.js.map +1 -0
- package/es/src/components/Axis/axisLayout.js +208 -0
- package/es/src/components/Axis/axisLayout.js.map +1 -0
- package/es/src/components/Axis/axisLayoutLabels.js +177 -0
- package/es/src/components/Axis/axisLayoutLabels.js.map +1 -0
- package/es/src/components/Axis/axisLayoutScale.js +374 -0
- package/es/src/components/Axis/axisLayoutScale.js.map +1 -0
- package/es/src/components/Axis/axisRender.js +535 -0
- package/es/src/components/Axis/axisRender.js.map +1 -0
- package/es/src/components/ColorScale/ColorScale.js +506 -0
- package/es/src/components/ColorScale/ColorScale.js.map +1 -0
- package/es/src/components/ColorScale/colorScaleRender.js +277 -0
- package/es/src/components/ColorScale/colorScaleRender.js.map +1 -0
- package/es/src/components/ColorScale/colorScaleScale.js +274 -0
- package/es/src/components/ColorScale/colorScaleScale.js.map +1 -0
- package/es/src/components/Legend/Legend.js +445 -0
- package/es/src/components/Legend/Legend.js.map +1 -0
- package/es/src/components/Legend/legendConfig.js +87 -0
- package/es/src/components/Legend/legendConfig.js.map +1 -0
- package/es/src/components/Legend/legendRender.js +245 -0
- package/es/src/components/Legend/legendRender.js.map +1 -0
- package/es/src/components/Message.js.map +1 -1
- package/es/src/components/TextBox.js +655 -453
- package/es/src/components/TextBox.js.map +1 -1
- package/es/src/components/Timeline/Timeline.js +674 -0
- package/es/src/components/Timeline/Timeline.js.map +1 -0
- package/es/src/components/Timeline/timelineConfig.js +115 -0
- package/es/src/components/Timeline/timelineConfig.js.map +1 -0
- package/es/src/components/Timeline/timelineRender.js +267 -0
- package/es/src/components/Timeline/timelineRender.js.map +1 -0
- package/es/src/components/Tooltip.js +288 -249
- package/es/src/components/Tooltip.js.map +1 -1
- package/es/src/components/index.js +8 -8
- package/es/src/components/index.js.map +1 -1
- package/es/src/fluent.js +265 -0
- package/es/src/fluent.js.map +1 -0
- package/es/src/shapes/Area.js +96 -114
- package/es/src/shapes/Area.js.map +1 -1
- package/es/src/shapes/Bar.js +71 -86
- package/es/src/shapes/Bar.js.map +1 -1
- package/es/src/shapes/Box.js +295 -190
- package/es/src/shapes/Box.js.map +1 -1
- package/es/src/shapes/Circle.js +84 -35
- package/es/src/shapes/Circle.js.map +1 -1
- package/es/src/shapes/Image.js +164 -85
- package/es/src/shapes/Image.js.map +1 -1
- package/es/src/shapes/Line.js +51 -94
- package/es/src/shapes/Line.js.map +1 -1
- package/es/src/shapes/Path.js +33 -41
- package/es/src/shapes/Path.js.map +1 -1
- package/es/src/shapes/Rect.js +86 -37
- package/es/src/shapes/Rect.js.map +1 -1
- package/es/src/shapes/Shape.js +655 -678
- package/es/src/shapes/Shape.js.map +1 -1
- package/es/src/shapes/Whisker.js +156 -61
- package/es/src/shapes/Whisker.js.map +1 -1
- package/es/src/shapes/buildLabelData.js +125 -0
- package/es/src/shapes/buildLabelData.js.map +1 -0
- package/es/src/shapes/emitLabels.js +84 -0
- package/es/src/shapes/emitLabels.js.map +1 -0
- package/es/src/shapes/hitAreaNode.js +37 -0
- package/es/src/shapes/hitAreaNode.js.map +1 -0
- package/es/src/shapes/sceneSort.js +57 -0
- package/es/src/shapes/sceneSort.js.map +1 -0
- package/es/src/shapes/shapeConfig.js +31 -0
- package/es/src/shapes/shapeConfig.js.map +1 -0
- package/es/src/utils/BaseClass.js +35 -19
- package/es/src/utils/BaseClass.js.map +1 -1
- package/es/src/utils/D3Scale.js +16 -0
- package/es/src/utils/D3Scale.js.map +1 -0
- package/es/src/utils/D3plusConfig.js.map +1 -1
- package/es/src/utils/configPrep.js +8 -3
- package/es/src/utils/configPrep.js.map +1 -1
- package/es/src/utils/getProp.js +1 -1
- package/es/src/utils/getProp.js.map +1 -1
- package/es/src/utils/index.js +1 -0
- package/es/src/utils/index.js.map +1 -1
- package/es/src/utils/paintComponentScene.js +59 -0
- package/es/src/utils/paintComponentScene.js.map +1 -0
- package/es/umd-entry.js +16 -0
- package/es/umd-entry.js.map +1 -0
- package/package.json +15 -10
- package/types/index.d.ts +3 -1
- package/types/internal.d.ts +54 -0
- package/types/src/charts/AreaPlot/index.d.ts +10 -0
- package/types/src/charts/BarChart/index.d.ts +10 -0
- package/types/src/charts/BoxWhisker/index.d.ts +11 -0
- package/types/src/charts/BumpChart/index.d.ts +11 -0
- package/types/src/charts/ChartDefinition.d.ts +75 -0
- package/types/src/charts/Donut/index.d.ts +13 -0
- package/types/src/charts/Geomap/applyLayout.d.ts +7 -0
- package/types/src/charts/Geomap/emit.d.ts +7 -0
- package/types/src/charts/Geomap/index.d.ts +14 -0
- package/types/src/charts/Geomap.d.ts +6 -0
- package/types/src/charts/LinePlot/index.d.ts +10 -0
- package/types/src/charts/Matrix/applyLayout.d.ts +9 -0
- package/types/src/charts/Matrix/emit.d.ts +6 -0
- package/types/src/charts/Matrix/index.d.ts +14 -0
- package/types/src/charts/Matrix.d.ts +0 -26
- package/types/src/charts/Network/applyLayout.d.ts +10 -0
- package/types/src/charts/Network/emit.d.ts +6 -0
- package/types/src/charts/Network/index.d.ts +7 -0
- package/types/src/charts/Network.d.ts +0 -24
- package/types/src/charts/Pack/applyLayout.d.ts +16 -0
- package/types/src/charts/Pack/emit.d.ts +6 -0
- package/types/src/charts/Pack/index.d.ts +15 -0
- package/types/src/charts/Pack/recursionCircles.d.ts +7 -0
- package/types/src/charts/Pack.d.ts +0 -13
- package/types/src/charts/Pie/applyLayout.d.ts +8 -0
- package/types/src/charts/Pie/emit.d.ts +5 -0
- package/types/src/charts/Pie/index.d.ts +14 -0
- package/types/src/charts/Pie.d.ts +0 -27
- package/types/src/charts/Plot/draw.d.ts +2 -0
- package/types/src/charts/Plot/index.d.ts +167 -0
- package/types/src/charts/Plot/labelPlacement.d.ts +15 -0
- package/types/src/charts/Plot/pipeline.d.ts +70 -0
- package/types/src/charts/Plot/pipelineDomains.d.ts +2 -0
- package/types/src/charts/Plot/pipelineLineLabels.d.ts +2 -0
- package/types/src/charts/Plot/shapeDefaults.d.ts +64 -0
- package/types/src/charts/Plot/stackHelpers.d.ts +24 -0
- package/types/src/charts/Plot.d.ts +23 -72
- package/types/src/charts/Priestley/applyLayout.d.ts +21 -0
- package/types/src/charts/Priestley/emit.d.ts +6 -0
- package/types/src/charts/Priestley/index.d.ts +14 -0
- package/types/src/charts/Radar/applyLayout.d.ts +10 -0
- package/types/src/charts/Radar/emit.d.ts +7 -0
- package/types/src/charts/Radar/index.d.ts +14 -0
- package/types/src/charts/RadialMatrix/applyLayout.d.ts +11 -0
- package/types/src/charts/RadialMatrix/emit.d.ts +6 -0
- package/types/src/charts/RadialMatrix/index.d.ts +14 -0
- package/types/src/charts/RadialMatrix.d.ts +0 -15
- package/types/src/charts/Rings/applyLayout.d.ts +2 -0
- package/types/src/charts/Rings/emit.d.ts +7 -0
- package/types/src/charts/Rings/index.d.ts +15 -0
- package/types/src/charts/Rings.d.ts +0 -13
- package/types/src/charts/Sankey/applyLayout.d.ts +7 -0
- package/types/src/charts/Sankey/emit.d.ts +6 -0
- package/types/src/charts/Sankey/index.d.ts +7 -0
- package/types/src/charts/Sankey.d.ts +0 -4
- package/types/src/charts/StackedArea/index.d.ts +10 -0
- package/types/src/charts/Tree/applyLayout.d.ts +2 -0
- package/types/src/charts/Tree/emit.d.ts +7 -0
- package/types/src/charts/Tree/index.d.ts +14 -0
- package/types/src/charts/Tree.d.ts +0 -16
- package/types/src/charts/Treemap/applyLayout.d.ts +16 -0
- package/types/src/charts/Treemap/emit.d.ts +6 -0
- package/types/src/charts/Treemap/index.d.ts +18 -0
- package/types/src/charts/Treemap/thresholdFunction.d.ts +25 -0
- package/types/src/charts/Treemap.d.ts +4 -13
- package/types/src/charts/Viz.d.ts +49 -361
- package/types/src/charts/VizBase.d.ts +158 -0
- package/types/src/charts/VizBaseConfig.d.ts +148 -0
- package/types/src/charts/applyDefinition.d.ts +13 -0
- package/types/src/charts/axes.d.ts +134 -0
- package/types/src/charts/chartGeometry.d.ts +58 -0
- package/types/src/charts/definition/ChartDefinition.d.ts +84 -0
- package/types/src/charts/definition/applyDefinition.d.ts +13 -0
- package/types/src/charts/definition/makeChart.d.ts +22 -0
- package/types/src/charts/drawSteps/zoomControls.d.ts +25 -5
- package/types/src/charts/emitHelpers.d.ts +122 -0
- package/types/src/charts/ensureZoomDom.d.ts +39 -0
- package/types/src/charts/events/click.legend.d.ts +1 -1
- package/types/src/charts/events/click.shape.d.ts +1 -1
- package/types/src/charts/events/mouseenter.d.ts +1 -1
- package/types/src/charts/events/mouseleave.d.ts +1 -1
- package/types/src/charts/events/mousemove.legend.d.ts +1 -1
- package/types/src/charts/events/mousemove.shape.d.ts +1 -1
- package/types/src/charts/events/touchstart.body.d.ts +1 -1
- package/types/src/charts/factories.d.ts +73 -0
- package/types/src/charts/features/axes.d.ts +134 -0
- package/types/src/charts/features/chartGeometry.d.ts +58 -0
- package/types/src/charts/features/colorScaleBucket.d.ts +43 -0
- package/types/src/charts/features/colorScaleBucketShare.d.ts +16 -0
- package/types/src/charts/features/emitHelpers.d.ts +123 -0
- package/types/src/charts/features/ensureZoomDom.d.ts +39 -0
- package/types/src/charts/features/features.d.ts +152 -0
- package/types/src/charts/features/featuresLegend.d.ts +12 -0
- package/types/src/charts/features/legendLabel.d.ts +11 -0
- package/types/src/charts/features/lineLabels.d.ts +40 -0
- package/types/src/charts/features/plotPaint.d.ts +233 -0
- package/types/src/charts/features/shapeEmit.d.ts +61 -0
- package/types/src/charts/features.d.ts +152 -0
- package/types/src/charts/featuresLegend.d.ts +12 -0
- package/types/src/charts/helpers/matrixData.d.ts +1 -1
- package/types/src/charts/index.d.ts +21 -21
- package/types/src/charts/legendLabel.d.ts +11 -0
- package/types/src/charts/lineLabels.d.ts +40 -0
- package/types/src/charts/makeChart.d.ts +22 -0
- package/types/src/charts/pipeline/resolveSpec.d.ts +51 -0
- package/types/src/charts/pipeline/runChartDraw.d.ts +38 -0
- package/types/src/charts/pipeline/runVizPipeline.d.ts +31 -0
- package/types/src/charts/pipeline/stages.d.ts +160 -0
- package/types/src/charts/pipeline/vizContext.d.ts +45 -0
- package/types/src/charts/pipeline/vizDraw.d.ts +25 -0
- package/types/src/charts/pipeline/vizDrawPure.d.ts +46 -0
- package/types/src/charts/pipeline/vizPreDraw.d.ts +22 -0
- package/types/src/charts/pipeline/vizPreDrawPure.d.ts +68 -0
- package/types/src/charts/plotBuffers/Bar.d.ts +6 -5
- package/types/src/charts/plotBuffers/Box.d.ts +6 -5
- package/types/src/charts/plotBuffers/Circle.d.ts +6 -5
- package/types/src/charts/plotBuffers/Line.d.ts +6 -5
- package/types/src/charts/plotBuffers/Rect.d.ts +6 -5
- package/types/src/charts/plotBuffers/discreteBuffer.d.ts +2 -1
- package/types/src/charts/plotBuffers/numericBuffer.d.ts +2 -1
- package/types/src/charts/plotPaint.d.ts +233 -0
- package/types/src/charts/resolveSpec.d.ts +50 -0
- package/types/src/charts/runChartDraw.d.ts +38 -0
- package/types/src/charts/runVizPipeline.d.ts +31 -0
- package/types/src/charts/shapeEmit.d.ts +61 -0
- package/types/src/charts/stages.d.ts +117 -0
- package/types/src/charts/viz/Viz.d.ts +111 -0
- package/types/src/charts/viz/VizBase.d.ts +160 -0
- package/types/src/charts/viz/VizBaseConfig.d.ts +157 -0
- package/types/src/charts/viz/interactionOpacity.d.ts +23 -0
- package/types/src/charts/viz/ordinalColor.d.ts +14 -0
- package/types/src/charts/viz/trailCatchup.d.ts +14 -0
- package/types/src/charts/viz/vizDefaults.d.ts +8 -0
- package/types/src/charts/viz/vizRender.d.ts +8 -0
- package/types/src/charts/viz/vizTypes.d.ts +250 -0
- package/types/src/charts/vizContext.d.ts +46 -0
- package/types/src/charts/vizDefaults.d.ts +8 -0
- package/types/src/charts/vizDraw.d.ts +25 -0
- package/types/src/charts/vizDrawPure.d.ts +17 -0
- package/types/src/charts/vizPreDraw.d.ts +22 -0
- package/types/src/charts/vizPreDrawPure.d.ts +40 -0
- package/types/src/charts/vizRender.d.ts +8 -0
- package/types/src/charts/vizTypes.d.ts +202 -0
- package/types/src/components/Axis/Axis.d.ts +182 -0
- package/types/src/components/Axis/AxisBottom.d.ts +11 -0
- package/types/src/components/Axis/AxisLeft.d.ts +11 -0
- package/types/src/components/Axis/AxisRight.d.ts +11 -0
- package/types/src/components/Axis/AxisTop.d.ts +11 -0
- package/types/src/components/Axis/axisLayout.d.ts +29 -0
- package/types/src/components/Axis/axisLayoutLabels.d.ts +70 -0
- package/types/src/components/Axis/axisLayoutScale.d.ts +14 -0
- package/types/src/components/Axis/axisRender.d.ts +68 -0
- package/types/src/components/Axis.d.ts +68 -194
- package/types/src/components/ColorScale/ColorScale.d.ts +100 -0
- package/types/src/components/ColorScale/colorScaleRender.d.ts +15 -0
- package/types/src/components/ColorScale/colorScaleScale.d.ts +19 -0
- package/types/src/components/ColorScale.d.ts +1 -129
- package/types/src/components/Legend/Legend.d.ts +95 -0
- package/types/src/components/Legend/legendConfig.d.ts +7 -0
- package/types/src/components/Legend/legendRender.d.ts +16 -0
- package/types/src/components/Legend.d.ts +9 -73
- package/types/src/components/TextBox.d.ts +25 -218
- package/types/src/components/Timeline/Timeline.d.ts +118 -0
- package/types/src/components/Timeline/timelineConfig.d.ts +6 -0
- package/types/src/components/Timeline/timelineRender.d.ts +24 -0
- package/types/src/components/Timeline.d.ts +7 -81
- package/types/src/components/Tooltip.d.ts +20 -200
- package/types/src/components/axisLayout.d.ts +27 -0
- package/types/src/components/axisLayoutLabels.d.ts +42 -0
- package/types/src/components/axisLayoutScale.d.ts +12 -0
- package/types/src/components/axisRender.d.ts +65 -0
- package/types/src/components/colorScaleRender.d.ts +15 -0
- package/types/src/components/colorScaleScale.d.ts +19 -0
- package/types/src/components/index.d.ts +8 -8
- package/types/src/components/legendConfig.d.ts +7 -0
- package/types/src/components/legendRender.d.ts +16 -0
- package/types/src/components/timelineConfig.d.ts +6 -0
- package/types/src/components/timelineRender.d.ts +14 -0
- package/types/src/fluent.d.ts +94 -0
- package/types/src/shapes/Area.d.ts +15 -27
- package/types/src/shapes/Bar.d.ts +13 -33
- package/types/src/shapes/Box.d.ts +17 -56
- package/types/src/shapes/Circle.d.ts +11 -17
- package/types/src/shapes/Image.d.ts +18 -84
- package/types/src/shapes/Line.d.ts +12 -22
- package/types/src/shapes/Path.d.ts +12 -19
- package/types/src/shapes/Rect.d.ts +11 -27
- package/types/src/shapes/Shape.d.ts +46 -257
- package/types/src/shapes/Whisker.d.ts +15 -42
- package/types/src/shapes/buildLabelData.d.ts +50 -0
- package/types/src/shapes/emitLabels.d.ts +16 -0
- package/types/src/shapes/hitAreaNode.d.ts +19 -0
- package/types/src/shapes/sceneSort.d.ts +20 -0
- package/types/src/shapes/shapeConfig.d.ts +226 -0
- package/types/src/utils/BaseClass.d.ts +13 -7
- package/types/src/utils/D3Scale.d.ts +48 -0
- package/types/src/utils/D3plusConfig.d.ts +270 -15
- package/types/src/utils/configPrep.d.ts +7 -4
- package/types/src/utils/getProp.d.ts +3 -1
- package/types/src/utils/index.d.ts +3 -1
- package/types/src/utils/paintComponentScene.d.ts +28 -0
- package/types/umd-entry.d.ts +15 -0
- package/umd/d3plus-core.full.js +30966 -19051
- package/umd/d3plus-core.full.js.map +1 -1
- package/umd/d3plus-core.full.min.js +5400 -2949
- package/umd/d3plus-core.js +17364 -10534
- package/umd/d3plus-core.js.map +1 -1
- package/umd/d3plus-core.min.js +3494 -1877
- package/es/src/charts/AreaPlot.js +0 -85
- package/es/src/charts/AreaPlot.js.map +0 -1
- package/es/src/charts/BarChart.js +0 -92
- package/es/src/charts/BarChart.js.map +0 -1
- package/es/src/charts/BoxWhisker.js +0 -92
- package/es/src/charts/BoxWhisker.js.map +0 -1
- package/es/src/charts/BumpChart.js +0 -147
- package/es/src/charts/BumpChart.js.map +0 -1
- package/es/src/charts/Donut.js +0 -84
- package/es/src/charts/Donut.js.map +0 -1
- package/es/src/charts/Geomap.js +0 -766
- package/es/src/charts/Geomap.js.map +0 -1
- package/es/src/charts/LinePlot.js +0 -83
- package/es/src/charts/LinePlot.js.map +0 -1
- package/es/src/charts/Matrix.js +0 -341
- package/es/src/charts/Matrix.js.map +0 -1
- package/es/src/charts/Network.js +0 -796
- package/es/src/charts/Network.js.map +0 -1
- package/es/src/charts/Pack.js +0 -308
- package/es/src/charts/Pack.js.map +0 -1
- package/es/src/charts/Pie.js +0 -232
- package/es/src/charts/Pie.js.map +0 -1
- package/es/src/charts/Plot.js +0 -2114
- package/es/src/charts/Plot.js.map +0 -1
- package/es/src/charts/Priestley.js +0 -296
- package/es/src/charts/Priestley.js.map +0 -1
- package/es/src/charts/Radar.js +0 -420
- package/es/src/charts/Radar.js.map +0 -1
- package/es/src/charts/RadialMatrix.js +0 -383
- package/es/src/charts/RadialMatrix.js.map +0 -1
- package/es/src/charts/Rings.js +0 -788
- package/es/src/charts/Rings.js.map +0 -1
- package/es/src/charts/Sankey.js +0 -461
- package/es/src/charts/Sankey.js.map +0 -1
- package/es/src/charts/StackedArea.js +0 -80
- package/es/src/charts/StackedArea.js.map +0 -1
- package/es/src/charts/Tree.js +0 -347
- package/es/src/charts/Tree.js.map +0 -1
- package/es/src/charts/Treemap.js +0 -454
- package/es/src/charts/Treemap.js.map +0 -1
- package/es/src/charts/Viz.js +0 -1832
- package/es/src/charts/Viz.js.map +0 -1
- package/es/src/charts/drawSteps/drawAttribution.js +0 -16
- package/es/src/charts/drawSteps/drawAttribution.js.map +0 -1
- package/es/src/charts/drawSteps/drawBack.js +0 -24
- package/es/src/charts/drawSteps/drawBack.js.map +0 -1
- package/es/src/charts/drawSteps/drawColorScale.js +0 -75
- package/es/src/charts/drawSteps/drawColorScale.js.map +0 -1
- package/es/src/charts/drawSteps/drawLegend.js +0 -122
- package/es/src/charts/drawSteps/drawLegend.js.map +0 -1
- package/es/src/charts/drawSteps/drawSubtitle.js +0 -31
- package/es/src/charts/drawSteps/drawSubtitle.js.map +0 -1
- package/es/src/charts/drawSteps/drawTimeline.js +0 -85
- package/es/src/charts/drawSteps/drawTimeline.js.map +0 -1
- package/es/src/charts/drawSteps/drawTitle.js +0 -31
- package/es/src/charts/drawSteps/drawTitle.js.map +0 -1
- package/es/src/charts/drawSteps/drawTotal.js +0 -32
- package/es/src/charts/drawSteps/drawTotal.js.map +0 -1
- package/es/src/components/Axis.js +0 -1457
- package/es/src/components/Axis.js.map +0 -1
- package/es/src/components/AxisBottom.js.map +0 -1
- package/es/src/components/AxisLeft.js.map +0 -1
- package/es/src/components/AxisRight.js.map +0 -1
- package/es/src/components/AxisTop.js.map +0 -1
- package/es/src/components/ColorScale.js +0 -843
- package/es/src/components/ColorScale.js.map +0 -1
- package/es/src/components/Legend.js +0 -622
- package/es/src/components/Legend.js.map +0 -1
- package/es/src/components/Timeline.js +0 -695
- package/es/src/components/Timeline.js.map +0 -1
- /package/es/src/components/{AxisBottom.js → Axis/AxisBottom.js} +0 -0
- /package/es/src/components/{AxisLeft.js → Axis/AxisLeft.js} +0 -0
- /package/es/src/components/{AxisRight.js → Axis/AxisRight.js} +0 -0
- /package/es/src/components/{AxisTop.js → Axis/AxisTop.js} +0 -0
|
@@ -1,622 +0,0 @@
|
|
|
1
|
-
function _assert_this_initialized(self) {
|
|
2
|
-
if (self === void 0) {
|
|
3
|
-
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
4
|
-
}
|
|
5
|
-
return self;
|
|
6
|
-
}
|
|
7
|
-
function _call_super(_this, derived, args) {
|
|
8
|
-
derived = _get_prototype_of(derived);
|
|
9
|
-
return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
|
|
10
|
-
}
|
|
11
|
-
function _class_call_check(instance, Constructor) {
|
|
12
|
-
if (!(instance instanceof Constructor)) {
|
|
13
|
-
throw new TypeError("Cannot call a class as a function");
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
function _defineProperties(target, props) {
|
|
17
|
-
for(var i = 0; i < props.length; i++){
|
|
18
|
-
var descriptor = props[i];
|
|
19
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
20
|
-
descriptor.configurable = true;
|
|
21
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
22
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
function _create_class(Constructor, protoProps, staticProps) {
|
|
26
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
27
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
28
|
-
return Constructor;
|
|
29
|
-
}
|
|
30
|
-
function _define_property(obj, key, value) {
|
|
31
|
-
if (key in obj) {
|
|
32
|
-
Object.defineProperty(obj, key, {
|
|
33
|
-
value: value,
|
|
34
|
-
enumerable: true,
|
|
35
|
-
configurable: true,
|
|
36
|
-
writable: true
|
|
37
|
-
});
|
|
38
|
-
} else {
|
|
39
|
-
obj[key] = value;
|
|
40
|
-
}
|
|
41
|
-
return obj;
|
|
42
|
-
}
|
|
43
|
-
function _get_prototype_of(o) {
|
|
44
|
-
_get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
|
|
45
|
-
return o.__proto__ || Object.getPrototypeOf(o);
|
|
46
|
-
};
|
|
47
|
-
return _get_prototype_of(o);
|
|
48
|
-
}
|
|
49
|
-
function _inherits(subClass, superClass) {
|
|
50
|
-
if (typeof superClass !== "function" && superClass !== null) {
|
|
51
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
52
|
-
}
|
|
53
|
-
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
54
|
-
constructor: {
|
|
55
|
-
value: subClass,
|
|
56
|
-
writable: true,
|
|
57
|
-
configurable: true
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
if (superClass) _set_prototype_of(subClass, superClass);
|
|
61
|
-
}
|
|
62
|
-
function _possible_constructor_return(self, call) {
|
|
63
|
-
if (call && (_type_of(call) === "object" || typeof call === "function")) {
|
|
64
|
-
return call;
|
|
65
|
-
}
|
|
66
|
-
return _assert_this_initialized(self);
|
|
67
|
-
}
|
|
68
|
-
function _set_prototype_of(o, p) {
|
|
69
|
-
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
70
|
-
o.__proto__ = p;
|
|
71
|
-
return o;
|
|
72
|
-
};
|
|
73
|
-
return _set_prototype_of(o, p);
|
|
74
|
-
}
|
|
75
|
-
function _type_of(obj) {
|
|
76
|
-
"@swc/helpers - typeof";
|
|
77
|
-
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
78
|
-
}
|
|
79
|
-
function _is_native_reflect_construct() {
|
|
80
|
-
try {
|
|
81
|
-
var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
82
|
-
} catch (_) {}
|
|
83
|
-
return (_is_native_reflect_construct = function() {
|
|
84
|
-
return !!result;
|
|
85
|
-
})();
|
|
86
|
-
}
|
|
87
|
-
import { max, sum } from "d3-array";
|
|
88
|
-
import { select } from "d3-selection";
|
|
89
|
-
import { colorContrast } from "@d3plus/color";
|
|
90
|
-
import { assign, backgroundColor, elem, rtl as detectRTL, textWidth } from "@d3plus/dom";
|
|
91
|
-
import { textWrap } from "@d3plus/text";
|
|
92
|
-
import { TextBox } from "../components/index.js";
|
|
93
|
-
import * as shapes from "../shapes/index.js";
|
|
94
|
-
import { accessor, BaseClass, configPrep, constant } from "../utils/index.js";
|
|
95
|
-
var padding = 5;
|
|
96
|
-
var Legend = /*#__PURE__*/ function(BaseClass) {
|
|
97
|
-
"use strict";
|
|
98
|
-
_inherits(Legend, BaseClass);
|
|
99
|
-
function Legend() {
|
|
100
|
-
_class_call_check(this, Legend);
|
|
101
|
-
var _this;
|
|
102
|
-
_this = _call_super(this, Legend), _define_property(_this, "_titleClass", void 0), _define_property(_this, "_align", void 0), _define_property(_this, "_data", void 0), _define_property(_this, "_direction", void 0), _define_property(_this, "_duration", void 0), _define_property(_this, "_height", void 0), _define_property(_this, "_id", void 0), _define_property(_this, "_label", void 0), _define_property(_this, "_lineData", void 0), _define_property(_this, "_outerBounds", void 0), _define_property(_this, "_padding", void 0), _define_property(_this, "_shape", void 0), _define_property(_this, "_select", void 0), _define_property(_this, "_shapes", void 0), _define_property(_this, "_shapeConfig", void 0), _define_property(_this, "_titleConfig", void 0), _define_property(_this, "_verticalAlign", void 0), _define_property(_this, "_width", void 0), _define_property(_this, "_rtl", void 0), _define_property(_this, "_group", void 0), _define_property(_this, "_titleGroup", void 0), _define_property(_this, "_shapeGroup", void 0), _define_property(_this, "_titleHeight", void 0), _define_property(_this, "_titleWidth", void 0), _define_property(_this, "_title", void 0), _define_property(_this, "_wrapLines", void 0), _define_property(_this, "_wrapRows", void 0);
|
|
103
|
-
_this._titleClass = new TextBox();
|
|
104
|
-
_this._align = "center";
|
|
105
|
-
_this._data = [];
|
|
106
|
-
_this._direction = "row";
|
|
107
|
-
_this._duration = 600;
|
|
108
|
-
_this._height = 200;
|
|
109
|
-
_this._id = accessor("id");
|
|
110
|
-
_this._label = accessor("id");
|
|
111
|
-
_this._lineData = [];
|
|
112
|
-
_this._outerBounds = {
|
|
113
|
-
width: 0,
|
|
114
|
-
height: 0,
|
|
115
|
-
x: 0,
|
|
116
|
-
y: 0
|
|
117
|
-
};
|
|
118
|
-
_this._padding = 5;
|
|
119
|
-
_this._shape = constant("Rect");
|
|
120
|
-
_this._shapes = [];
|
|
121
|
-
_this._shapeConfig = {
|
|
122
|
-
fill: accessor("color"),
|
|
123
|
-
height: constant(12),
|
|
124
|
-
hitArea: function hitArea(dd, i) {
|
|
125
|
-
var d = _this._lineData[i], h = max([
|
|
126
|
-
d.height,
|
|
127
|
-
d.shapeHeight
|
|
128
|
-
]);
|
|
129
|
-
return {
|
|
130
|
-
width: d.width + d.shapeWidth,
|
|
131
|
-
height: h,
|
|
132
|
-
x: -d.shapeWidth / 2,
|
|
133
|
-
y: -h / 2
|
|
134
|
-
};
|
|
135
|
-
},
|
|
136
|
-
labelBounds: function labelBounds(dd, i) {
|
|
137
|
-
var d = _this._lineData[i];
|
|
138
|
-
var x = d.shapeWidth / 2;
|
|
139
|
-
if (d.shape === "Circle") x -= d.shapeR / 2;
|
|
140
|
-
var height = max([
|
|
141
|
-
d.shapeHeight,
|
|
142
|
-
d.height
|
|
143
|
-
]);
|
|
144
|
-
var rtlMod = _this._rtl ? d.shapeWidth + d.width + _this._padding * 2 : 0;
|
|
145
|
-
return {
|
|
146
|
-
width: d.width,
|
|
147
|
-
height: height,
|
|
148
|
-
x: x + padding - rtlMod,
|
|
149
|
-
y: -height / 2
|
|
150
|
-
};
|
|
151
|
-
},
|
|
152
|
-
labelConfig: {
|
|
153
|
-
fontColor: function fontColor() {
|
|
154
|
-
var bg = _this._select ? backgroundColor(_this._select.node()) : "rgb(255, 255, 255)";
|
|
155
|
-
return colorContrast(bg);
|
|
156
|
-
},
|
|
157
|
-
fontFamily: _this._titleClass.fontFamily(),
|
|
158
|
-
fontResize: false,
|
|
159
|
-
fontSize: constant(10),
|
|
160
|
-
verticalAlign: "middle"
|
|
161
|
-
},
|
|
162
|
-
opacity: 1,
|
|
163
|
-
r: constant(6),
|
|
164
|
-
width: constant(12),
|
|
165
|
-
x: function x(d, i) {
|
|
166
|
-
var datum = _this._lineData[i];
|
|
167
|
-
var y = datum.y;
|
|
168
|
-
var pad = _this._align === "left" || _this._align === "right" && _this._direction === "column" ? 0 : _this._align === "center" ? (_this._outerBounds.width - _this._rowWidth(_this._lineData.filter(function(l) {
|
|
169
|
-
return y === l.y;
|
|
170
|
-
}))) / 2 : _this._outerBounds.width - _this._rowWidth(_this._lineData.filter(function(l) {
|
|
171
|
-
return y === l.y;
|
|
172
|
-
}));
|
|
173
|
-
var prevWords = _this._lineData.slice(0, i).filter(function(l) {
|
|
174
|
-
return y === l.y;
|
|
175
|
-
});
|
|
176
|
-
var rtlMod = _this._rtl ? datum.width + _this._padding : 0;
|
|
177
|
-
return _this._rowWidth(prevWords) + _this._padding * (prevWords.length ? datum.sentence ? 2 : 1 : 0) + _this._outerBounds.x + datum.shapeWidth / 2 + pad + rtlMod;
|
|
178
|
-
},
|
|
179
|
-
y: function y(d, i) {
|
|
180
|
-
var ld = _this._lineData[i];
|
|
181
|
-
return ld.y + _this._titleHeight + _this._outerBounds.y + max(_this._lineData.filter(function(l) {
|
|
182
|
-
return ld.y === l.y;
|
|
183
|
-
}).map(function(l) {
|
|
184
|
-
return l.height;
|
|
185
|
-
}).concat(_this._data.map(function(l, x) {
|
|
186
|
-
return _this._fetchConfig("height", l, x);
|
|
187
|
-
}))) / 2;
|
|
188
|
-
}
|
|
189
|
-
};
|
|
190
|
-
_this._titleConfig = {
|
|
191
|
-
fontSize: 12
|
|
192
|
-
};
|
|
193
|
-
_this._verticalAlign = "middle";
|
|
194
|
-
_this._width = 400;
|
|
195
|
-
_this._rtl = false;
|
|
196
|
-
_this._titleHeight = 0;
|
|
197
|
-
_this._titleWidth = 0;
|
|
198
|
-
return _this;
|
|
199
|
-
}
|
|
200
|
-
_create_class(Legend, [
|
|
201
|
-
{
|
|
202
|
-
/**
|
|
203
|
-
@param key The configuration key.
|
|
204
|
-
@param d The data point.
|
|
205
|
-
@param i The data index.
|
|
206
|
-
@private
|
|
207
|
-
*/ key: "_fetchConfig",
|
|
208
|
-
value: function _fetchConfig(key, d, i) {
|
|
209
|
-
var labelConfig = this._shapeConfig.labelConfig;
|
|
210
|
-
var val = this._shapeConfig[key] !== undefined ? this._shapeConfig[key] : labelConfig === null || labelConfig === void 0 ? void 0 : labelConfig[key];
|
|
211
|
-
if (!val && key === "lineHeight") return this._fetchConfig("fontSize", d, i) * 1.4;
|
|
212
|
-
return typeof val === "function" ? val(d, i) : val;
|
|
213
|
-
}
|
|
214
|
-
},
|
|
215
|
-
{
|
|
216
|
-
/**
|
|
217
|
-
@param row The legend row data.
|
|
218
|
-
@private
|
|
219
|
-
*/ key: "_rowHeight",
|
|
220
|
-
value: function _rowHeight(row) {
|
|
221
|
-
return max(row.map(function(d) {
|
|
222
|
-
return d.height;
|
|
223
|
-
}).concat(row.map(function(d) {
|
|
224
|
-
return d.shapeHeight;
|
|
225
|
-
}))) + this._padding;
|
|
226
|
-
}
|
|
227
|
-
},
|
|
228
|
-
{
|
|
229
|
-
/**
|
|
230
|
-
@param row The legend row data.
|
|
231
|
-
@private
|
|
232
|
-
*/ key: "_rowWidth",
|
|
233
|
-
value: function _rowWidth(row) {
|
|
234
|
-
var _this = this;
|
|
235
|
-
return sum(row.map(function(d, i) {
|
|
236
|
-
var p = _this._padding * (i === row.length - 1 ? 0 : d.width ? 2 : 1);
|
|
237
|
-
return d.shapeWidth + d.width + p;
|
|
238
|
-
}));
|
|
239
|
-
}
|
|
240
|
-
},
|
|
241
|
-
{
|
|
242
|
-
/**
|
|
243
|
-
Renders the current Legend to the page.
|
|
244
|
-
@param callback Optional callback invoked after rendering completes.
|
|
245
|
-
*/ key: "render",
|
|
246
|
-
value: function render(callback) {
|
|
247
|
-
var _this = this;
|
|
248
|
-
if (this._select === void 0) this.select(select("body").append("svg").attr("width", "".concat(this._width, "px")).attr("height", "".concat(this._height, "px")).node());
|
|
249
|
-
// Legend Container <g> Groups
|
|
250
|
-
this._group = elem("g.d3plus-Legend", {
|
|
251
|
-
parent: this._select
|
|
252
|
-
});
|
|
253
|
-
this._titleGroup = elem("g.d3plus-Legend-title", {
|
|
254
|
-
parent: this._group
|
|
255
|
-
});
|
|
256
|
-
this._shapeGroup = elem("g.d3plus-Legend-shape", {
|
|
257
|
-
parent: this._group
|
|
258
|
-
});
|
|
259
|
-
var availableHeight = this._height;
|
|
260
|
-
this._titleHeight = 0;
|
|
261
|
-
this._titleWidth = 0;
|
|
262
|
-
if (this._title) {
|
|
263
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
264
|
-
var f = this._titleConfig.fontFamily || this._titleClass.fontFamily()(), // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
265
|
-
s = this._titleConfig.fontSize || this._titleClass.fontSize()();
|
|
266
|
-
var lH = this._titleConfig.lineHeight || this._titleClass.lineHeight();
|
|
267
|
-
lH = typeof lH === "function" ? lH() : lH !== null && lH !== void 0 ? lH : s * 1.4;
|
|
268
|
-
var res = textWrap().fontFamily(f).fontSize(s).lineHeight(lH).width(this._width).height(this._height)(this._title);
|
|
269
|
-
this._titleHeight = lH + res.lines.length + this._padding;
|
|
270
|
-
this._titleWidth = max(res.widths);
|
|
271
|
-
availableHeight -= this._titleHeight;
|
|
272
|
-
}
|
|
273
|
-
// Calculate Text Sizes
|
|
274
|
-
this._lineData = this._data.map(function(d, i) {
|
|
275
|
-
var label = _this._label(d, i);
|
|
276
|
-
var shape = _this._shape(d, i);
|
|
277
|
-
var r = _this._fetchConfig("r", d, i);
|
|
278
|
-
var res = {
|
|
279
|
-
data: d,
|
|
280
|
-
i: i,
|
|
281
|
-
id: _this._id(d, i),
|
|
282
|
-
shape: shape,
|
|
283
|
-
shapeR: r,
|
|
284
|
-
shapeWidth: shape === "Circle" ? r * 2 : _this._fetchConfig("width", d, i),
|
|
285
|
-
shapeHeight: shape === "Circle" ? r * 2 : _this._fetchConfig("height", d, i),
|
|
286
|
-
y: 0
|
|
287
|
-
};
|
|
288
|
-
if (!label) {
|
|
289
|
-
res.sentence = false;
|
|
290
|
-
res.words = [];
|
|
291
|
-
res.height = 0;
|
|
292
|
-
res.width = 0;
|
|
293
|
-
return res;
|
|
294
|
-
}
|
|
295
|
-
var f = _this._fetchConfig("fontFamily", d, i), lh = _this._fetchConfig("lineHeight", d, i), s = _this._fetchConfig("fontSize", d, i);
|
|
296
|
-
var h = availableHeight - (_this._data.length + 1) * _this._padding, w = _this._width;
|
|
297
|
-
var newRes = textWrap().fontFamily(f).fontSize(s).lineHeight(lh).width(w).height(h)(label);
|
|
298
|
-
res = Object.assign(res, newRes);
|
|
299
|
-
res.width = Math.ceil(max(res.lines.map(function(t) {
|
|
300
|
-
return textWidth(t, {
|
|
301
|
-
"font-family": f,
|
|
302
|
-
"font-size": s
|
|
303
|
-
});
|
|
304
|
-
}))) + padding * 2;
|
|
305
|
-
res.height = Math.ceil(res.lines.length * (lh + 1));
|
|
306
|
-
res.og = {
|
|
307
|
-
height: res.height,
|
|
308
|
-
width: res.width
|
|
309
|
-
};
|
|
310
|
-
res.f = f;
|
|
311
|
-
res.s = s;
|
|
312
|
-
res.lh = lh;
|
|
313
|
-
return res;
|
|
314
|
-
});
|
|
315
|
-
var spaceNeeded;
|
|
316
|
-
var availableWidth = this._width - this._padding * 2;
|
|
317
|
-
spaceNeeded = this._rowWidth(this._lineData);
|
|
318
|
-
if (this._direction === "column" || spaceNeeded > availableWidth) {
|
|
319
|
-
var lines = 1, newRows = [];
|
|
320
|
-
var maxLines = max(this._lineData.map(function(d) {
|
|
321
|
-
return d.words.length;
|
|
322
|
-
}));
|
|
323
|
-
this._wrapLines = function() {
|
|
324
|
-
var _this = this;
|
|
325
|
-
lines++;
|
|
326
|
-
if (lines > maxLines) return;
|
|
327
|
-
var wrappable = lines === 1 ? this._lineData.slice() : this._lineData.filter(function(d) {
|
|
328
|
-
return d.width + d.shapeWidth + _this._padding * (d.width ? 2 : 1) > availableWidth && d.words.length >= lines;
|
|
329
|
-
}).sort(function(a, b) {
|
|
330
|
-
return b.sentence.length - a.sentence.length;
|
|
331
|
-
});
|
|
332
|
-
if (wrappable.length && availableHeight > wrappable[0].height * lines) {
|
|
333
|
-
var _loop = function(x) {
|
|
334
|
-
var label = wrappable[x];
|
|
335
|
-
var og = label.og;
|
|
336
|
-
var h = og.height * lines, w = og.width * (1.5 * (1 / lines));
|
|
337
|
-
var res = textWrap().fontFamily(label.f).fontSize(label.s).lineHeight(label.lh).width(w).height(h)(label.sentence);
|
|
338
|
-
if (!res.truncated) {
|
|
339
|
-
label.width = Math.ceil(max(res.lines.map(function(t) {
|
|
340
|
-
return textWidth(t, {
|
|
341
|
-
"font-family": label.f,
|
|
342
|
-
"font-size": label.s
|
|
343
|
-
});
|
|
344
|
-
}))) + label.s;
|
|
345
|
-
label.height = res.lines.length * (label.lh + 1);
|
|
346
|
-
} else {
|
|
347
|
-
truncated = true;
|
|
348
|
-
return "break";
|
|
349
|
-
}
|
|
350
|
-
};
|
|
351
|
-
var truncated = false;
|
|
352
|
-
for(var x = 0; x < wrappable.length; x++){
|
|
353
|
-
var _ret = _loop(x);
|
|
354
|
-
if (_ret === "break") break;
|
|
355
|
-
}
|
|
356
|
-
if (!truncated) this._wrapRows();
|
|
357
|
-
} else {
|
|
358
|
-
newRows = [];
|
|
359
|
-
return;
|
|
360
|
-
}
|
|
361
|
-
};
|
|
362
|
-
this._wrapRows = function() {
|
|
363
|
-
newRows = [];
|
|
364
|
-
var row = 1, rowWidth = 0;
|
|
365
|
-
for(var i = 0; i < this._lineData.length; i++){
|
|
366
|
-
var d = this._lineData[i], w = d.width + this._padding * (d.width ? 2 : 1) + d.shapeWidth;
|
|
367
|
-
if (sum(newRows.map(function(row) {
|
|
368
|
-
return max(row, function(d) {
|
|
369
|
-
return max([
|
|
370
|
-
d.height,
|
|
371
|
-
d.shapeHeight
|
|
372
|
-
]);
|
|
373
|
-
});
|
|
374
|
-
})) > availableHeight) {
|
|
375
|
-
newRows = [];
|
|
376
|
-
break;
|
|
377
|
-
}
|
|
378
|
-
if (w > availableWidth) {
|
|
379
|
-
newRows = [];
|
|
380
|
-
this._wrapLines();
|
|
381
|
-
break;
|
|
382
|
-
} else if (rowWidth + w < availableWidth) {
|
|
383
|
-
rowWidth += w;
|
|
384
|
-
} else if (this._direction !== "column") {
|
|
385
|
-
rowWidth = w;
|
|
386
|
-
row++;
|
|
387
|
-
}
|
|
388
|
-
if (!newRows[row - 1]) newRows[row - 1] = [];
|
|
389
|
-
newRows[row - 1].push(d);
|
|
390
|
-
if (this._direction === "column") {
|
|
391
|
-
rowWidth = 0;
|
|
392
|
-
row++;
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
};
|
|
396
|
-
this._wrapRows();
|
|
397
|
-
if (!newRows.length || sum(newRows, this._rowHeight.bind(this)) + this._padding > availableHeight) {
|
|
398
|
-
spaceNeeded = sum(this._lineData.map(function(d) {
|
|
399
|
-
return d.shapeWidth + _this._padding;
|
|
400
|
-
})) - this._padding;
|
|
401
|
-
for(var i = 0; i < this._lineData.length; i++){
|
|
402
|
-
this._lineData[i].width = 0;
|
|
403
|
-
this._lineData[i].height = 0;
|
|
404
|
-
}
|
|
405
|
-
this._wrapRows();
|
|
406
|
-
}
|
|
407
|
-
if (newRows.length && sum(newRows, this._rowHeight.bind(this)) + this._padding < availableHeight) {
|
|
408
|
-
newRows.forEach(function(row, i) {
|
|
409
|
-
row.forEach(function(d) {
|
|
410
|
-
if (i) {
|
|
411
|
-
d.y = sum(newRows.slice(0, i), _this._rowHeight.bind(_this));
|
|
412
|
-
}
|
|
413
|
-
});
|
|
414
|
-
});
|
|
415
|
-
spaceNeeded = max(newRows, this._rowWidth.bind(this));
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
var innerHeight = max(this._lineData, function(d, i) {
|
|
419
|
-
return max([
|
|
420
|
-
d.height,
|
|
421
|
-
_this._fetchConfig("height", d.data, i)
|
|
422
|
-
]) + d.y;
|
|
423
|
-
}) + this._titleHeight, innerWidth = max([
|
|
424
|
-
spaceNeeded,
|
|
425
|
-
this._titleWidth
|
|
426
|
-
]);
|
|
427
|
-
this._outerBounds.width = innerWidth;
|
|
428
|
-
this._outerBounds.height = innerHeight;
|
|
429
|
-
var xOffset = this._padding, yOffset = this._padding;
|
|
430
|
-
if (this._align === "center") xOffset = (this._width - innerWidth) / 2;
|
|
431
|
-
else if (this._align === "right") xOffset = this._width - this._padding - innerWidth;
|
|
432
|
-
if (this._verticalAlign === "middle") yOffset = (this._height - innerHeight) / 2;
|
|
433
|
-
else if (this._verticalAlign === "bottom") yOffset = this._height - this._padding - innerHeight;
|
|
434
|
-
this._outerBounds.x = xOffset;
|
|
435
|
-
this._outerBounds.y = yOffset;
|
|
436
|
-
this._titleClass.data(this._title ? [
|
|
437
|
-
{
|
|
438
|
-
text: this._title
|
|
439
|
-
}
|
|
440
|
-
] : []).duration(this._duration).select(this._titleGroup.node()).textAnchor({
|
|
441
|
-
left: "start",
|
|
442
|
-
center: "middle",
|
|
443
|
-
right: "end"
|
|
444
|
-
}[this._align]).width(this._width - this._padding * 2).x(this._padding).y(this._outerBounds.y).config(this._titleConfig).render();
|
|
445
|
-
this._shapes = [];
|
|
446
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
447
|
-
var baseConfig = configPrep.bind(this)(this._shapeConfig, "legend"), config = {
|
|
448
|
-
id: function id(d) {
|
|
449
|
-
return d.id;
|
|
450
|
-
},
|
|
451
|
-
label: function label(d) {
|
|
452
|
-
return d.label;
|
|
453
|
-
},
|
|
454
|
-
lineHeight: function lineHeight(d) {
|
|
455
|
-
return d.lH;
|
|
456
|
-
}
|
|
457
|
-
};
|
|
458
|
-
var data = this._data.map(function(d, i) {
|
|
459
|
-
var obj = {
|
|
460
|
-
__d3plus__: true,
|
|
461
|
-
data: d,
|
|
462
|
-
i: i,
|
|
463
|
-
id: _this._id(d, i),
|
|
464
|
-
label: _this._lineData[i].width ? _this._label(d, i) : false,
|
|
465
|
-
lH: _this._fetchConfig("lineHeight", d, i),
|
|
466
|
-
shape: _this._shape(d, i)
|
|
467
|
-
};
|
|
468
|
-
return obj;
|
|
469
|
-
});
|
|
470
|
-
// Legend Shapes
|
|
471
|
-
this._shapes = [];
|
|
472
|
-
[
|
|
473
|
-
"Circle",
|
|
474
|
-
"Rect"
|
|
475
|
-
].forEach(function(Shape) {
|
|
476
|
-
_this._shapes.push(// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
477
|
-
new shapes[Shape]().parent(_this).data(data.filter(function(d) {
|
|
478
|
-
return d.shape === Shape;
|
|
479
|
-
})).duration(_this._duration).labelConfig({
|
|
480
|
-
padding: 0
|
|
481
|
-
}).select(_this._shapeGroup.node()).verticalAlign("top").config(assign({}, baseConfig, config)).render());
|
|
482
|
-
});
|
|
483
|
-
if (callback) setTimeout(callback, this._duration + 100);
|
|
484
|
-
return this;
|
|
485
|
-
}
|
|
486
|
-
},
|
|
487
|
-
{
|
|
488
|
-
/**
|
|
489
|
-
The active method for all shapes.
|
|
490
|
-
*/ key: "active",
|
|
491
|
-
value: function active(_) {
|
|
492
|
-
this._shapes.forEach(function(s) {
|
|
493
|
-
return s.active(_);
|
|
494
|
-
});
|
|
495
|
-
return this;
|
|
496
|
-
}
|
|
497
|
-
},
|
|
498
|
-
{
|
|
499
|
-
key: "align",
|
|
500
|
-
value: function align(_) {
|
|
501
|
-
return arguments.length ? (this._align = _, this) : this._align;
|
|
502
|
-
}
|
|
503
|
-
},
|
|
504
|
-
{
|
|
505
|
-
key: "data",
|
|
506
|
-
value: function data(_) {
|
|
507
|
-
return arguments.length ? (this._data = _, this) : this._data;
|
|
508
|
-
}
|
|
509
|
-
},
|
|
510
|
-
{
|
|
511
|
-
key: "direction",
|
|
512
|
-
value: function direction(_) {
|
|
513
|
-
return arguments.length ? (this._direction = _, this) : this._direction;
|
|
514
|
-
}
|
|
515
|
-
},
|
|
516
|
-
{
|
|
517
|
-
key: "duration",
|
|
518
|
-
value: function duration(_) {
|
|
519
|
-
return arguments.length ? (this._duration = _, this) : this._duration;
|
|
520
|
-
}
|
|
521
|
-
},
|
|
522
|
-
{
|
|
523
|
-
key: "height",
|
|
524
|
-
value: function height(_) {
|
|
525
|
-
return arguments.length ? (this._height = _, this) : this._height;
|
|
526
|
-
}
|
|
527
|
-
},
|
|
528
|
-
{
|
|
529
|
-
/**
|
|
530
|
-
The hover method for all shapes.
|
|
531
|
-
*/ key: "hover",
|
|
532
|
-
value: function hover(_) {
|
|
533
|
-
this._shapes.forEach(function(s) {
|
|
534
|
-
return s.hover(_);
|
|
535
|
-
});
|
|
536
|
-
return this;
|
|
537
|
-
}
|
|
538
|
-
},
|
|
539
|
-
{
|
|
540
|
-
key: "id",
|
|
541
|
-
value: function id(_) {
|
|
542
|
-
return arguments.length ? (this._id = _, this) : this._id;
|
|
543
|
-
}
|
|
544
|
-
},
|
|
545
|
-
{
|
|
546
|
-
key: "label",
|
|
547
|
-
value: function label(_) {
|
|
548
|
-
return arguments.length ? (this._label = typeof _ === "function" ? _ : constant(_), this) : this._label;
|
|
549
|
-
}
|
|
550
|
-
},
|
|
551
|
-
{
|
|
552
|
-
/**
|
|
553
|
-
Returns the outer bounds of the legend content. Must be called after rendering.
|
|
554
|
-
@example
|
|
555
|
-
{"width": 180, "height": 24, "x": 10, "y": 20}
|
|
556
|
-
*/ key: "outerBounds",
|
|
557
|
-
value: function outerBounds() {
|
|
558
|
-
return this._outerBounds;
|
|
559
|
-
}
|
|
560
|
-
},
|
|
561
|
-
{
|
|
562
|
-
key: "padding",
|
|
563
|
-
value: function padding(_) {
|
|
564
|
-
return arguments.length ? (this._padding = _, this) : this._padding;
|
|
565
|
-
}
|
|
566
|
-
},
|
|
567
|
-
{
|
|
568
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
569
|
-
key: "select",
|
|
570
|
-
value: function select1(_) {
|
|
571
|
-
if (arguments.length) {
|
|
572
|
-
this._select = select(_);
|
|
573
|
-
this._rtl = detectRTL();
|
|
574
|
-
return this;
|
|
575
|
-
}
|
|
576
|
-
return this._select;
|
|
577
|
-
}
|
|
578
|
-
},
|
|
579
|
-
{
|
|
580
|
-
key: "shape",
|
|
581
|
-
value: function shape(_) {
|
|
582
|
-
return arguments.length ? (this._shape = typeof _ === "function" ? _ : constant(_), this) : this._shape;
|
|
583
|
-
}
|
|
584
|
-
},
|
|
585
|
-
{
|
|
586
|
-
key: "shapeConfig",
|
|
587
|
-
value: function shapeConfig(_) {
|
|
588
|
-
return arguments.length ? (this._shapeConfig = assign(this._shapeConfig, _), this) : this._shapeConfig;
|
|
589
|
-
}
|
|
590
|
-
},
|
|
591
|
-
{
|
|
592
|
-
key: "title",
|
|
593
|
-
value: function title(_) {
|
|
594
|
-
return arguments.length ? (this._title = _, this) : this._title;
|
|
595
|
-
}
|
|
596
|
-
},
|
|
597
|
-
{
|
|
598
|
-
key: "titleConfig",
|
|
599
|
-
value: function titleConfig(_) {
|
|
600
|
-
return arguments.length ? (this._titleConfig = assign(this._titleConfig, _), this) : this._titleConfig;
|
|
601
|
-
}
|
|
602
|
-
},
|
|
603
|
-
{
|
|
604
|
-
key: "verticalAlign",
|
|
605
|
-
value: function verticalAlign(_) {
|
|
606
|
-
return arguments.length ? (this._verticalAlign = _, this) : this._verticalAlign;
|
|
607
|
-
}
|
|
608
|
-
},
|
|
609
|
-
{
|
|
610
|
-
key: "width",
|
|
611
|
-
value: function width(_) {
|
|
612
|
-
return arguments.length ? (this._width = _, this) : this._width;
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
]);
|
|
616
|
-
return Legend;
|
|
617
|
-
}(BaseClass);
|
|
618
|
-
/**
|
|
619
|
-
Creates an SVG legend based on an array of data.
|
|
620
|
-
*/ export { Legend as default };
|
|
621
|
-
|
|
622
|
-
//# sourceMappingURL=Legend.js.map
|