@d3plus/core 3.1.6 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9922 -78537
- 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 +639 -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 +72 -31
- 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 +70 -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 +14 -9
- 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 +156 -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 +230 -3
- 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 +31148 -19484
- package/umd/d3plus-core.full.js.map +1 -1
- package/umd/d3plus-core.full.min.js +5309 -2944
- package/umd/d3plus-core.js +17379 -10578
- package/umd/d3plus-core.js.map +1 -1
- package/umd/d3plus-core.min.js +3470 -1876
- 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
package/es/src/charts/Network.js
DELETED
|
@@ -1,796 +0,0 @@
|
|
|
1
|
-
function _array_like_to_array(arr, len) {
|
|
2
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
3
|
-
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
4
|
-
return arr2;
|
|
5
|
-
}
|
|
6
|
-
function _array_with_holes(arr) {
|
|
7
|
-
if (Array.isArray(arr)) return arr;
|
|
8
|
-
}
|
|
9
|
-
function _assert_this_initialized(self) {
|
|
10
|
-
if (self === void 0) {
|
|
11
|
-
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
12
|
-
}
|
|
13
|
-
return self;
|
|
14
|
-
}
|
|
15
|
-
function _call_super(_this, derived, args) {
|
|
16
|
-
derived = _get_prototype_of(derived);
|
|
17
|
-
return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
|
|
18
|
-
}
|
|
19
|
-
function _class_call_check(instance, Constructor) {
|
|
20
|
-
if (!(instance instanceof Constructor)) {
|
|
21
|
-
throw new TypeError("Cannot call a class as a function");
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
function _defineProperties(target, props) {
|
|
25
|
-
for(var i = 0; i < props.length; i++){
|
|
26
|
-
var descriptor = props[i];
|
|
27
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
28
|
-
descriptor.configurable = true;
|
|
29
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
30
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
function _create_class(Constructor, protoProps, staticProps) {
|
|
34
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
35
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
36
|
-
return Constructor;
|
|
37
|
-
}
|
|
38
|
-
function _get(target, property, receiver) {
|
|
39
|
-
if (typeof Reflect !== "undefined" && Reflect.get) {
|
|
40
|
-
_get = Reflect.get;
|
|
41
|
-
} else {
|
|
42
|
-
_get = function get(target, property, receiver) {
|
|
43
|
-
var base = _super_prop_base(target, property);
|
|
44
|
-
if (!base) return;
|
|
45
|
-
var desc = Object.getOwnPropertyDescriptor(base, property);
|
|
46
|
-
if (desc.get) {
|
|
47
|
-
return desc.get.call(receiver || target);
|
|
48
|
-
}
|
|
49
|
-
return desc.value;
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
return _get(target, property, receiver || target);
|
|
53
|
-
}
|
|
54
|
-
function _get_prototype_of(o) {
|
|
55
|
-
_get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
|
|
56
|
-
return o.__proto__ || Object.getPrototypeOf(o);
|
|
57
|
-
};
|
|
58
|
-
return _get_prototype_of(o);
|
|
59
|
-
}
|
|
60
|
-
function _inherits(subClass, superClass) {
|
|
61
|
-
if (typeof superClass !== "function" && superClass !== null) {
|
|
62
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
63
|
-
}
|
|
64
|
-
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
65
|
-
constructor: {
|
|
66
|
-
value: subClass,
|
|
67
|
-
writable: true,
|
|
68
|
-
configurable: true
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
if (superClass) _set_prototype_of(subClass, superClass);
|
|
72
|
-
}
|
|
73
|
-
function _instanceof(left, right) {
|
|
74
|
-
"@swc/helpers - instanceof";
|
|
75
|
-
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
76
|
-
return !!right[Symbol.hasInstance](left);
|
|
77
|
-
} else {
|
|
78
|
-
return left instanceof right;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
function _iterable_to_array_limit(arr, i) {
|
|
82
|
-
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
83
|
-
if (_i == null) return;
|
|
84
|
-
var _arr = [];
|
|
85
|
-
var _n = true;
|
|
86
|
-
var _d = false;
|
|
87
|
-
var _s, _e;
|
|
88
|
-
try {
|
|
89
|
-
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
90
|
-
_arr.push(_s.value);
|
|
91
|
-
if (i && _arr.length === i) break;
|
|
92
|
-
}
|
|
93
|
-
} catch (err) {
|
|
94
|
-
_d = true;
|
|
95
|
-
_e = err;
|
|
96
|
-
} finally{
|
|
97
|
-
try {
|
|
98
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
99
|
-
} finally{
|
|
100
|
-
if (_d) throw _e;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
return _arr;
|
|
104
|
-
}
|
|
105
|
-
function _non_iterable_rest() {
|
|
106
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
107
|
-
}
|
|
108
|
-
function _possible_constructor_return(self, call) {
|
|
109
|
-
if (call && (_type_of(call) === "object" || typeof call === "function")) {
|
|
110
|
-
return call;
|
|
111
|
-
}
|
|
112
|
-
return _assert_this_initialized(self);
|
|
113
|
-
}
|
|
114
|
-
function _set_prototype_of(o, p) {
|
|
115
|
-
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
116
|
-
o.__proto__ = p;
|
|
117
|
-
return o;
|
|
118
|
-
};
|
|
119
|
-
return _set_prototype_of(o, p);
|
|
120
|
-
}
|
|
121
|
-
function _sliced_to_array(arr, i) {
|
|
122
|
-
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
123
|
-
}
|
|
124
|
-
function _super_prop_base(object, property) {
|
|
125
|
-
while(!Object.prototype.hasOwnProperty.call(object, property)){
|
|
126
|
-
object = _get_prototype_of(object);
|
|
127
|
-
if (object === null) break;
|
|
128
|
-
}
|
|
129
|
-
return object;
|
|
130
|
-
}
|
|
131
|
-
function _type_of(obj) {
|
|
132
|
-
"@swc/helpers - typeof";
|
|
133
|
-
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
134
|
-
}
|
|
135
|
-
function _unsupported_iterable_to_array(o, minLen) {
|
|
136
|
-
if (!o) return;
|
|
137
|
-
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
138
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
139
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
140
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
141
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
142
|
-
}
|
|
143
|
-
function _is_native_reflect_construct() {
|
|
144
|
-
try {
|
|
145
|
-
var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
146
|
-
} catch (_) {}
|
|
147
|
-
return (_is_native_reflect_construct = function() {
|
|
148
|
-
return !!result;
|
|
149
|
-
})();
|
|
150
|
-
}
|
|
151
|
-
import { extent, groups, max, mean, min, merge } from "d3-array";
|
|
152
|
-
import { forceLink, forceManyBody, forceSimulation } from "d3-force";
|
|
153
|
-
import { polygonHull } from "d3-polygon";
|
|
154
|
-
import * as scales from "d3-scale";
|
|
155
|
-
import { zoomTransform } from "d3-zoom";
|
|
156
|
-
import { assign, elem } from "@d3plus/dom";
|
|
157
|
-
import { addToQueue } from "@d3plus/data";
|
|
158
|
-
import { largestRect, pointDistance, pointRotate } from "@d3plus/math";
|
|
159
|
-
import * as shapes from "../shapes/index.js";
|
|
160
|
-
import { accessor, configPrep, constant } from "../utils/index.js";
|
|
161
|
-
import Viz from "./Viz.js";
|
|
162
|
-
/**
|
|
163
|
-
* Fetches the unique ID for a data point, whether it's defined by data or nodes.
|
|
164
|
-
* @private
|
|
165
|
-
*/ function getNodeId(d, i) {
|
|
166
|
-
return "".concat(this._id(d, i) || this._nodeGroupBy[min([
|
|
167
|
-
this._drawDepth,
|
|
168
|
-
this._nodeGroupBy.length - 1
|
|
169
|
-
])](d, i));
|
|
170
|
-
}
|
|
171
|
-
var Network = /*#__PURE__*/ function(Viz) {
|
|
172
|
-
"use strict";
|
|
173
|
-
_inherits(Network, Viz);
|
|
174
|
-
function Network() {
|
|
175
|
-
_class_call_check(this, Network);
|
|
176
|
-
var _this;
|
|
177
|
-
_this = _call_super(this, Network);
|
|
178
|
-
_this._links = [];
|
|
179
|
-
_this._linkSize = constant(1);
|
|
180
|
-
_this._linkSizeMin = 1;
|
|
181
|
-
_this._linkSizeScale = "sqrt";
|
|
182
|
-
_this._noDataMessage = false;
|
|
183
|
-
_this._nodeGroupBy = [
|
|
184
|
-
accessor("id")
|
|
185
|
-
];
|
|
186
|
-
_this._nodes = [];
|
|
187
|
-
_this._on["click.shape"] = function(d, i, x, event) {
|
|
188
|
-
_this._tooltipClass.data([]).render();
|
|
189
|
-
if (_this._hover && _this._drawDepth >= _this._groupBy.length - 1) {
|
|
190
|
-
var id = getNodeId.bind(_this)(d, i);
|
|
191
|
-
if (_this._focus && _this._focus === id) {
|
|
192
|
-
_this.active(false);
|
|
193
|
-
_this._on.mouseenter.bind(_this)(d, i, x, event);
|
|
194
|
-
_this._focus = undefined;
|
|
195
|
-
_this._zoomToBounds(null);
|
|
196
|
-
} else {
|
|
197
|
-
_this.hover(false);
|
|
198
|
-
var links = _this._linkLookup[id], node = _this._nodeLookup[id];
|
|
199
|
-
var filterIds = [
|
|
200
|
-
id
|
|
201
|
-
];
|
|
202
|
-
var xDomain = [
|
|
203
|
-
node.x - node.r,
|
|
204
|
-
node.x + node.r
|
|
205
|
-
], yDomain = [
|
|
206
|
-
node.y - node.r,
|
|
207
|
-
node.y + node.r
|
|
208
|
-
];
|
|
209
|
-
links.forEach(function(l) {
|
|
210
|
-
filterIds.push(l.id);
|
|
211
|
-
if (l.x - l.r < xDomain[0]) xDomain[0] = l.x - l.r;
|
|
212
|
-
if (l.x + l.r > xDomain[1]) xDomain[1] = l.x + l.r;
|
|
213
|
-
if (l.y - l.r < yDomain[0]) yDomain[0] = l.y - l.r;
|
|
214
|
-
if (l.y + l.r > yDomain[1]) yDomain[1] = l.y + l.r;
|
|
215
|
-
});
|
|
216
|
-
_this.active(function(h, x) {
|
|
217
|
-
if (h.source && h.target) return h.source.id === id || h.target.id === id;
|
|
218
|
-
else return filterIds.includes(getNodeId.bind(_this)(h, x));
|
|
219
|
-
});
|
|
220
|
-
_this._focus = id;
|
|
221
|
-
var t = zoomTransform(_this._container.node());
|
|
222
|
-
xDomain = xDomain.map(function(d) {
|
|
223
|
-
return d * t.k + t.x;
|
|
224
|
-
});
|
|
225
|
-
yDomain = yDomain.map(function(d) {
|
|
226
|
-
return d * t.k + t.y;
|
|
227
|
-
});
|
|
228
|
-
_this._zoomToBounds([
|
|
229
|
-
[
|
|
230
|
-
xDomain[0],
|
|
231
|
-
yDomain[0]
|
|
232
|
-
],
|
|
233
|
-
[
|
|
234
|
-
xDomain[1],
|
|
235
|
-
yDomain[1]
|
|
236
|
-
]
|
|
237
|
-
]);
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
};
|
|
241
|
-
_this._on["click.legend"] = function(d, i, x, event) {
|
|
242
|
-
var ids = _this._id(d);
|
|
243
|
-
var id = _this._ids(d);
|
|
244
|
-
id = id[id.length - 1];
|
|
245
|
-
if (_this._hover && _this._drawDepth >= _this._groupBy.length - 1) {
|
|
246
|
-
if (_this._focus && _this._focus === ids) {
|
|
247
|
-
_this.active(false);
|
|
248
|
-
_this._focus = undefined;
|
|
249
|
-
_this._zoomToBounds(null);
|
|
250
|
-
} else {
|
|
251
|
-
_this.hover(false);
|
|
252
|
-
var nodes = ids.map(function(id) {
|
|
253
|
-
return _this._nodeLookup[id];
|
|
254
|
-
});
|
|
255
|
-
var filterIds = [
|
|
256
|
-
"".concat(id)
|
|
257
|
-
];
|
|
258
|
-
var xDomain = [
|
|
259
|
-
nodes[0].x - nodes[0].r,
|
|
260
|
-
nodes[0].x + nodes[0].r
|
|
261
|
-
], yDomain = [
|
|
262
|
-
nodes[0].y - nodes[0].r,
|
|
263
|
-
nodes[0].y + nodes[0].r
|
|
264
|
-
];
|
|
265
|
-
nodes.forEach(function(l) {
|
|
266
|
-
filterIds.push(l.id);
|
|
267
|
-
if (l.x - l.r < xDomain[0]) xDomain[0] = l.x - l.r;
|
|
268
|
-
if (l.x + l.r > xDomain[1]) xDomain[1] = l.x + l.r;
|
|
269
|
-
if (l.y - l.r < yDomain[0]) yDomain[0] = l.y - l.r;
|
|
270
|
-
if (l.y + l.r > yDomain[1]) yDomain[1] = l.y + l.r;
|
|
271
|
-
});
|
|
272
|
-
_this.active(function(h, x) {
|
|
273
|
-
if (h.source && h.target) return filterIds.includes(h.source.id) && filterIds.includes(h.target.id);
|
|
274
|
-
else {
|
|
275
|
-
var myIds = _this._ids(h, x);
|
|
276
|
-
return filterIds.includes("".concat(myIds[myIds.length - 1]));
|
|
277
|
-
}
|
|
278
|
-
});
|
|
279
|
-
_this._focus = ids;
|
|
280
|
-
var t = zoomTransform(_this._container.node());
|
|
281
|
-
xDomain = xDomain.map(function(d) {
|
|
282
|
-
return d * t.k + t.x;
|
|
283
|
-
});
|
|
284
|
-
yDomain = yDomain.map(function(d) {
|
|
285
|
-
return d * t.k + t.y;
|
|
286
|
-
});
|
|
287
|
-
_this._zoomToBounds([
|
|
288
|
-
[
|
|
289
|
-
xDomain[0],
|
|
290
|
-
yDomain[0]
|
|
291
|
-
],
|
|
292
|
-
[
|
|
293
|
-
xDomain[1],
|
|
294
|
-
yDomain[1]
|
|
295
|
-
]
|
|
296
|
-
]);
|
|
297
|
-
}
|
|
298
|
-
_this._on.mouseenter.bind(_this)(d, i, x, event);
|
|
299
|
-
_this._on["mousemove.legend"].bind(_this)(d, i, x, event);
|
|
300
|
-
}
|
|
301
|
-
};
|
|
302
|
-
_this._on.mouseenter = function() {};
|
|
303
|
-
_this._on["mouseleave.shape"] = function() {
|
|
304
|
-
_this.hover(false);
|
|
305
|
-
};
|
|
306
|
-
var defaultMouseMove = _this._on["mousemove.shape"];
|
|
307
|
-
_this._on["mousemove.shape"] = function(d, i, x, event) {
|
|
308
|
-
defaultMouseMove(d, i, x, event);
|
|
309
|
-
var id = getNodeId.bind(_this)(d, i), links = _this._linkLookup[id] || [], node = _this._nodeLookup[id];
|
|
310
|
-
var filterIds = [
|
|
311
|
-
id
|
|
312
|
-
];
|
|
313
|
-
var xDomain = [
|
|
314
|
-
node.x - node.r,
|
|
315
|
-
node.x + node.r
|
|
316
|
-
], yDomain = [
|
|
317
|
-
node.y - node.r,
|
|
318
|
-
node.y + node.r
|
|
319
|
-
];
|
|
320
|
-
links.forEach(function(l) {
|
|
321
|
-
filterIds.push(l.id);
|
|
322
|
-
if (l.x - l.r < xDomain[0]) xDomain[0] = l.x - l.r;
|
|
323
|
-
if (l.x + l.r > xDomain[1]) xDomain[1] = l.x + l.r;
|
|
324
|
-
if (l.y - l.r < yDomain[0]) yDomain[0] = l.y - l.r;
|
|
325
|
-
if (l.y + l.r > yDomain[1]) yDomain[1] = l.y + l.r;
|
|
326
|
-
});
|
|
327
|
-
_this.hover(function(h, x) {
|
|
328
|
-
if (h.source && h.target) return h.source.id === id || h.target.id === id;
|
|
329
|
-
else return filterIds.includes("".concat(_this._ids(h, x)[_this._drawDepth]));
|
|
330
|
-
});
|
|
331
|
-
};
|
|
332
|
-
_this._sizeMin = 5;
|
|
333
|
-
_this._sizeScale = "sqrt";
|
|
334
|
-
_this._shape = constant("Circle");
|
|
335
|
-
_this._shapeConfig = assign(_this._shapeConfig, {
|
|
336
|
-
ariaLabel: function ariaLabel(d, i) {
|
|
337
|
-
var validSize = _this._size ? ", ".concat(_this._size(d, i)) : "";
|
|
338
|
-
return "".concat(_this._drawLabel(d, i)).concat(validSize, ".");
|
|
339
|
-
},
|
|
340
|
-
labelConfig: {
|
|
341
|
-
duration: 0,
|
|
342
|
-
fontMin: 1,
|
|
343
|
-
fontResize: true,
|
|
344
|
-
labelPadding: 0,
|
|
345
|
-
textAnchor: "middle",
|
|
346
|
-
verticalAlign: "middle"
|
|
347
|
-
},
|
|
348
|
-
Path: {
|
|
349
|
-
fill: "none",
|
|
350
|
-
label: false,
|
|
351
|
-
stroke: "#eee"
|
|
352
|
-
}
|
|
353
|
-
});
|
|
354
|
-
_this._x = accessor("x");
|
|
355
|
-
_this._y = accessor("y");
|
|
356
|
-
_this._zoom = true;
|
|
357
|
-
return _this;
|
|
358
|
-
}
|
|
359
|
-
_create_class(Network, [
|
|
360
|
-
{
|
|
361
|
-
/**
|
|
362
|
-
Extends the draw behavior of the abstract Viz class.
|
|
363
|
-
@private
|
|
364
|
-
*/ key: "_draw",
|
|
365
|
-
value: function _draw(callback) {
|
|
366
|
-
var _this = this;
|
|
367
|
-
_get(_get_prototype_of(Network.prototype), "_draw", this).call(this, callback);
|
|
368
|
-
var duration = this._duration, height = this._height - this._margin.top - this._margin.bottom, transform = "translate(".concat(this._margin.left, ", ").concat(this._margin.top, ")"), width = this._width - this._margin.left - this._margin.right;
|
|
369
|
-
var data = this._filteredData.reduce(function(obj, d, i) {
|
|
370
|
-
obj[_this._id(d, i)] = d;
|
|
371
|
-
return obj;
|
|
372
|
-
}, {});
|
|
373
|
-
var nodes = this._nodes.reduce(function(obj, d, i) {
|
|
374
|
-
obj[getNodeId.bind(_this)(d, i)] = d;
|
|
375
|
-
return obj;
|
|
376
|
-
}, {});
|
|
377
|
-
nodes = Array.from(new Set(Object.keys(data).concat(Object.keys(nodes)))).map(function(id, i) {
|
|
378
|
-
var d = data[id], n = nodes[id];
|
|
379
|
-
if (n === undefined) return false;
|
|
380
|
-
return {
|
|
381
|
-
__d3plus__: true,
|
|
382
|
-
data: d || n,
|
|
383
|
-
i: i,
|
|
384
|
-
id: id,
|
|
385
|
-
fx: d !== undefined && !isNaN(_this._x(d)) ? _this._x(d) : _this._x(n),
|
|
386
|
-
fy: d !== undefined && !isNaN(_this._y(d)) ? _this._y(d) : _this._y(n),
|
|
387
|
-
node: n,
|
|
388
|
-
r: _this._size ? d !== undefined && _this._size(d) !== undefined ? _this._size(d) : _this._size(n) : _this._sizeMin,
|
|
389
|
-
shape: d !== undefined && _this._shape(d) !== undefined ? _this._shape(d) : _this._shape(n)
|
|
390
|
-
};
|
|
391
|
-
}).filter(function(n) {
|
|
392
|
-
return !!n;
|
|
393
|
-
});
|
|
394
|
-
var nodeLookup = this._nodeLookup = nodes.reduce(function(obj, d) {
|
|
395
|
-
obj[d.id] = d;
|
|
396
|
-
return obj;
|
|
397
|
-
}, {});
|
|
398
|
-
var nodeIndices = nodes.map(function(n) {
|
|
399
|
-
return n.node;
|
|
400
|
-
});
|
|
401
|
-
var links = this._links.map(function(l) {
|
|
402
|
-
var referenceType = _type_of(l.source);
|
|
403
|
-
return {
|
|
404
|
-
size: _this._linkSize(l),
|
|
405
|
-
source: referenceType === "number" ? nodes[nodeIndices.indexOf(_this._nodes[l.source])] : referenceType === "string" ? nodeLookup[l.source] : nodeLookup[l.source.id],
|
|
406
|
-
target: referenceType === "number" ? nodes[nodeIndices.indexOf(_this._nodes[l.target])] : referenceType === "string" ? nodeLookup[l.target] : nodeLookup[l.target.id]
|
|
407
|
-
};
|
|
408
|
-
});
|
|
409
|
-
this._linkLookup = links.reduce(function(obj, d) {
|
|
410
|
-
if (!obj[d.source.id]) obj[d.source.id] = [];
|
|
411
|
-
obj[d.source.id].push(d.target);
|
|
412
|
-
if (!obj[d.target.id]) obj[d.target.id] = [];
|
|
413
|
-
obj[d.target.id].push(d.source);
|
|
414
|
-
return obj;
|
|
415
|
-
}, {});
|
|
416
|
-
var missingCoords = nodes.some(function(n) {
|
|
417
|
-
return n.fx === undefined || n.fy === undefined;
|
|
418
|
-
});
|
|
419
|
-
if (missingCoords) {
|
|
420
|
-
var linkStrength = scales.scaleLinear().domain(extent(links, function(d) {
|
|
421
|
-
return d.size;
|
|
422
|
-
})).range([
|
|
423
|
-
0.1,
|
|
424
|
-
0.5
|
|
425
|
-
]);
|
|
426
|
-
var simulation = forceSimulation().force("link", forceLink(links).id(function(d) {
|
|
427
|
-
return d.id;
|
|
428
|
-
}).distance(1).strength(function(d) {
|
|
429
|
-
return linkStrength(d.size);
|
|
430
|
-
}).iterations(4)).force("charge", forceManyBody().strength(-1)).stop();
|
|
431
|
-
var iterations = 100;
|
|
432
|
-
var alphaMin = 0.001;
|
|
433
|
-
var alphaDecay = 1 - Math.pow(alphaMin, 1 / iterations);
|
|
434
|
-
simulation.velocityDecay(0);
|
|
435
|
-
simulation.alphaMin(alphaMin);
|
|
436
|
-
simulation.alphaDecay(alphaDecay);
|
|
437
|
-
simulation.alphaDecay(0);
|
|
438
|
-
simulation.nodes(nodes);
|
|
439
|
-
simulation.tick(iterations).stop();
|
|
440
|
-
var nodePositions = nodes.map(function(n) {
|
|
441
|
-
return [
|
|
442
|
-
n.vx,
|
|
443
|
-
n.vy
|
|
444
|
-
];
|
|
445
|
-
});
|
|
446
|
-
var angle = 0, cx = 0, cy = 0;
|
|
447
|
-
if (nodePositions.length === 2) {
|
|
448
|
-
angle = 100;
|
|
449
|
-
} else if (nodePositions.length > 2) {
|
|
450
|
-
var hull = polygonHull(nodePositions) || [];
|
|
451
|
-
var rect = largestRect(hull, {
|
|
452
|
-
verbose: true
|
|
453
|
-
});
|
|
454
|
-
angle = rect.angle;
|
|
455
|
-
cx = rect.cx;
|
|
456
|
-
cy = rect.cy;
|
|
457
|
-
}
|
|
458
|
-
nodes.forEach(function(n) {
|
|
459
|
-
var p = pointRotate([
|
|
460
|
-
n.vx,
|
|
461
|
-
n.vy
|
|
462
|
-
], -1 * (Math.PI / 180 * angle), [
|
|
463
|
-
cx,
|
|
464
|
-
cy
|
|
465
|
-
]);
|
|
466
|
-
n.fx = p[0];
|
|
467
|
-
n.fy = p[1];
|
|
468
|
-
});
|
|
469
|
-
}
|
|
470
|
-
var xExtent = extent(nodes.map(function(n) {
|
|
471
|
-
return n.fx;
|
|
472
|
-
})), yExtent = extent(nodes.map(function(n) {
|
|
473
|
-
return n.fy;
|
|
474
|
-
}));
|
|
475
|
-
var x = scales.scaleLinear().domain(xExtent).range([
|
|
476
|
-
0,
|
|
477
|
-
width
|
|
478
|
-
]), y = scales.scaleLinear().domain(yExtent).range([
|
|
479
|
-
0,
|
|
480
|
-
height
|
|
481
|
-
]);
|
|
482
|
-
var nodeRatio = (xExtent[1] - xExtent[0]) / (yExtent[1] - yExtent[0]) || 1, screenRatio = width / height;
|
|
483
|
-
if (nodeRatio > screenRatio) {
|
|
484
|
-
var h = height * screenRatio / nodeRatio;
|
|
485
|
-
y.range([
|
|
486
|
-
(height - h) / 2,
|
|
487
|
-
height - (height - h) / 2
|
|
488
|
-
]);
|
|
489
|
-
} else {
|
|
490
|
-
var w = width * nodeRatio / screenRatio;
|
|
491
|
-
x.range([
|
|
492
|
-
(width - w) / 2,
|
|
493
|
-
width - (width - w) / 2
|
|
494
|
-
]);
|
|
495
|
-
}
|
|
496
|
-
nodes.forEach(function(n) {
|
|
497
|
-
n.x = x(n.fx);
|
|
498
|
-
n.y = y(n.fy);
|
|
499
|
-
});
|
|
500
|
-
var rExtent = extent(nodes.map(function(n) {
|
|
501
|
-
return n.r;
|
|
502
|
-
}));
|
|
503
|
-
var rMax = this._sizeMax || max([
|
|
504
|
-
1,
|
|
505
|
-
min(merge(nodes.map(function(n1) {
|
|
506
|
-
return nodes.map(function(n2) {
|
|
507
|
-
return n1 === n2 ? null : pointDistance([
|
|
508
|
-
n1.x,
|
|
509
|
-
n1.y
|
|
510
|
-
], [
|
|
511
|
-
n2.x,
|
|
512
|
-
n2.y
|
|
513
|
-
]);
|
|
514
|
-
});
|
|
515
|
-
}))) / 2
|
|
516
|
-
]);
|
|
517
|
-
var r = scales["scale".concat(this._sizeScale.charAt(0).toUpperCase()).concat(this._sizeScale.slice(1))]().domain(rExtent).range([
|
|
518
|
-
rExtent[0] === rExtent[1] ? rMax : min([
|
|
519
|
-
rMax / 2,
|
|
520
|
-
this._sizeMin
|
|
521
|
-
]),
|
|
522
|
-
rMax
|
|
523
|
-
]), xDomain = x.domain(), yDomain = y.domain();
|
|
524
|
-
var xOldSize = xDomain[1] - xDomain[0], yOldSize = yDomain[1] - yDomain[0];
|
|
525
|
-
nodes.forEach(function(n) {
|
|
526
|
-
var size = r(n.r);
|
|
527
|
-
if (xDomain[0] > x.invert(n.x - size)) xDomain[0] = x.invert(n.x - size);
|
|
528
|
-
if (xDomain[1] < x.invert(n.x + size)) xDomain[1] = x.invert(n.x + size);
|
|
529
|
-
if (yDomain[0] > y.invert(n.y - size)) yDomain[0] = y.invert(n.y - size);
|
|
530
|
-
if (yDomain[1] < y.invert(n.y + size)) yDomain[1] = y.invert(n.y + size);
|
|
531
|
-
});
|
|
532
|
-
var xNewSize = xDomain[1] - xDomain[0], yNewSize = yDomain[1] - yDomain[0];
|
|
533
|
-
rMax *= min([
|
|
534
|
-
xOldSize / xNewSize,
|
|
535
|
-
yOldSize / yNewSize
|
|
536
|
-
]);
|
|
537
|
-
r.range([
|
|
538
|
-
rExtent[0] === rExtent[1] ? rMax : min([
|
|
539
|
-
rMax / 2,
|
|
540
|
-
this._sizeMin
|
|
541
|
-
]),
|
|
542
|
-
rMax
|
|
543
|
-
]);
|
|
544
|
-
x.domain(xDomain);
|
|
545
|
-
y.domain(yDomain);
|
|
546
|
-
var fallbackRadius = (nodeRatio > screenRatio ? width : height) / 2;
|
|
547
|
-
nodes.forEach(function(n) {
|
|
548
|
-
n.x = x(n.fx);
|
|
549
|
-
n.fx = n.x;
|
|
550
|
-
n.y = y(n.fy);
|
|
551
|
-
n.fy = n.y;
|
|
552
|
-
n.r = r(n.r) || fallbackRadius;
|
|
553
|
-
n.width = n.r * 2;
|
|
554
|
-
n.height = n.r * 2;
|
|
555
|
-
});
|
|
556
|
-
this._container = this._select.selectAll("svg.d3plus-network").data([
|
|
557
|
-
0
|
|
558
|
-
]);
|
|
559
|
-
this._container = this._container.enter().append("svg").attr("class", "d3plus-network").attr("opacity", 0).attr("width", width).attr("height", height).attr("x", this._margin.left).attr("y", this._margin.top).style("background-color", "transparent").merge(this._container);
|
|
560
|
-
this._container.transition().duration(duration).attr("opacity", 1).attr("width", width).attr("height", height).attr("x", this._margin.left).attr("y", this._margin.top);
|
|
561
|
-
var hitArea = this._container.selectAll("rect.d3plus-network-hitArea").data([
|
|
562
|
-
0
|
|
563
|
-
]);
|
|
564
|
-
hitArea.enter().append("rect").attr("class", "d3plus-network-hitArea").merge(hitArea).attr("width", width).attr("height", height).attr("fill", "transparent").on("click", function() {
|
|
565
|
-
if (_this._focus) {
|
|
566
|
-
_this.active(false);
|
|
567
|
-
_this._focus = undefined;
|
|
568
|
-
_this._zoomToBounds(null);
|
|
569
|
-
}
|
|
570
|
-
});
|
|
571
|
-
this._zoomGroup = this._container.selectAll("g.d3plus-network-zoomGroup").data([
|
|
572
|
-
0
|
|
573
|
-
]);
|
|
574
|
-
var parent = this._zoomGroup = this._zoomGroup.enter().append("g").attr("class", "d3plus-network-zoomGroup").merge(this._zoomGroup);
|
|
575
|
-
var strokeExtent = extent(links, function(d) {
|
|
576
|
-
return d.size;
|
|
577
|
-
});
|
|
578
|
-
if (strokeExtent[0] !== strokeExtent[1]) {
|
|
579
|
-
var strokeScale = scales["scale".concat(this._linkSizeScale.charAt(0).toUpperCase()).concat(this._linkSizeScale.slice(1))]().domain(strokeExtent).range([
|
|
580
|
-
this._linkSizeMin,
|
|
581
|
-
r.range()[0]
|
|
582
|
-
]);
|
|
583
|
-
links.forEach(function(link) {
|
|
584
|
-
link.size = strokeScale(link.size);
|
|
585
|
-
});
|
|
586
|
-
}
|
|
587
|
-
var linkConfig = configPrep.bind(this)(this._shapeConfig, "edge", "Path");
|
|
588
|
-
delete linkConfig.on;
|
|
589
|
-
this._shapes.push(new shapes.Path().config(linkConfig).strokeWidth(function(d) {
|
|
590
|
-
return d.size;
|
|
591
|
-
}).activeStyle({
|
|
592
|
-
"stroke-width": function(d) {
|
|
593
|
-
return d.size;
|
|
594
|
-
}
|
|
595
|
-
}).d(function(d) {
|
|
596
|
-
return "M".concat(d.source.x, ",").concat(d.source.y, " ").concat(d.target.x, ",").concat(d.target.y);
|
|
597
|
-
}).data(links).select(elem("g.d3plus-network-links", {
|
|
598
|
-
parent: parent,
|
|
599
|
-
duration: duration,
|
|
600
|
-
enter: {
|
|
601
|
-
transform: transform
|
|
602
|
-
},
|
|
603
|
-
update: {
|
|
604
|
-
transform: transform
|
|
605
|
-
}
|
|
606
|
-
}).node()).render());
|
|
607
|
-
var shapeConfig = {
|
|
608
|
-
label: function label(d) {
|
|
609
|
-
return nodes.length <= _this._dataCutoff || _this._hover && _this._hover(d) || _this._active && _this._active(d) ? _this._drawLabel(d.data || d.node, d.i) : false;
|
|
610
|
-
},
|
|
611
|
-
select: elem("g.d3plus-network-nodes", {
|
|
612
|
-
parent: parent,
|
|
613
|
-
duration: duration,
|
|
614
|
-
enter: {
|
|
615
|
-
transform: transform
|
|
616
|
-
},
|
|
617
|
-
update: {
|
|
618
|
-
transform: transform
|
|
619
|
-
}
|
|
620
|
-
}).node()
|
|
621
|
-
};
|
|
622
|
-
groups(nodes, function(d) {
|
|
623
|
-
return d.shape;
|
|
624
|
-
}).forEach(function(param) {
|
|
625
|
-
var _param = _sliced_to_array(param, 2), key = _param[0], values = _param[1];
|
|
626
|
-
_this._shapes.push(new shapes[key]().config(configPrep.bind(_this)(_this._shapeConfig, "shape", key)).config(shapeConfig).config(shapeConfig[key] || {}).data(values).render());
|
|
627
|
-
});
|
|
628
|
-
return this;
|
|
629
|
-
}
|
|
630
|
-
},
|
|
631
|
-
{
|
|
632
|
-
/**
|
|
633
|
-
The hover callback function for highlighting shapes on mouseover.
|
|
634
|
-
*/ key: "hover",
|
|
635
|
-
value: function hover(_) {
|
|
636
|
-
this._hover = _;
|
|
637
|
-
if (this._nodes.length < this._dataCutoff) {
|
|
638
|
-
this._shapes.forEach(function(s) {
|
|
639
|
-
return s.hover(_);
|
|
640
|
-
});
|
|
641
|
-
if (this._legend) this._legendClass.hover(_);
|
|
642
|
-
}
|
|
643
|
-
return this;
|
|
644
|
-
}
|
|
645
|
-
},
|
|
646
|
-
{
|
|
647
|
-
/**
|
|
648
|
-
A predefined *Array* of edges that connect each object passed to the [node](#Network.node) method. The `source` and `target` keys in each link need to map to the nodes in one of three ways:
|
|
649
|
-
1. The index of the node in the nodes array (as in [this](http://d3plus.org/examples/d3plus-network/getting-started/) example).
|
|
650
|
-
2. The actual node *Object* itself.
|
|
651
|
-
3. A *String* value matching the `id` of the node.
|
|
652
|
-
|
|
653
|
-
The value passed should either be an *Array* of data or a *String* representing a filepath or URL to be loaded. An optional formatting function can be passed as a second argument to this method. This custom function will be passed the data that has been loaded, as long as there are no errors. This function should return the final links *Array*.
|
|
654
|
-
@param f Array of link objects or a URL to load links from.
|
|
655
|
-
*/ key: "links",
|
|
656
|
-
value: function links(_, f) {
|
|
657
|
-
if (arguments.length) {
|
|
658
|
-
addToQueue.bind(this)(_, f, "links");
|
|
659
|
-
return this;
|
|
660
|
-
}
|
|
661
|
-
return this._links;
|
|
662
|
-
}
|
|
663
|
-
},
|
|
664
|
-
{
|
|
665
|
-
/**
|
|
666
|
-
Defines the thickness of the links connecting each node. The value provided can be either a pixel Number to be used for all links, or an accessor function that returns a specific data value to be used in an automatically calculated linear scale.
|
|
667
|
-
*/ key: "linkSize",
|
|
668
|
-
value: function linkSize(_) {
|
|
669
|
-
return arguments.length ? (this._linkSize = typeof _ === "function" ? _ : constant(_), this) : this._linkSize;
|
|
670
|
-
}
|
|
671
|
-
},
|
|
672
|
-
{
|
|
673
|
-
/**
|
|
674
|
-
Defines the minimum pixel stroke width used in link sizing.
|
|
675
|
-
*/ key: "linkSizeMin",
|
|
676
|
-
value: function linkSizeMin(_) {
|
|
677
|
-
return arguments.length ? (this._linkSizeMin = _, this) : this._linkSizeMin;
|
|
678
|
-
}
|
|
679
|
-
},
|
|
680
|
-
{
|
|
681
|
-
/**
|
|
682
|
-
The type of [continuous d3-scale](https://github.com/d3/d3-scale#continuous-scales) used when calculating the pixel size of links in the network.
|
|
683
|
-
*/ key: "linkSizeScale",
|
|
684
|
-
value: function linkSizeScale(_) {
|
|
685
|
-
return arguments.length ? (this._linkSizeScale = _, this) : this._linkSizeScale;
|
|
686
|
-
}
|
|
687
|
-
},
|
|
688
|
-
{
|
|
689
|
-
/**
|
|
690
|
-
The node group accessor(s). This method overrides the default .groupBy() function from being used with the data passed to .nodes().
|
|
691
|
-
*/ key: "nodeGroupBy",
|
|
692
|
-
value: function nodeGroupBy(_) {
|
|
693
|
-
var _this = this;
|
|
694
|
-
if (!arguments.length) return this._nodeGroupBy;
|
|
695
|
-
if (!_instanceof(_, Array)) _ = [
|
|
696
|
-
_
|
|
697
|
-
];
|
|
698
|
-
return this._nodeGroupBy = _.map(function(k) {
|
|
699
|
-
if (typeof k === "function") return k;
|
|
700
|
-
else {
|
|
701
|
-
if (!_this._aggs[k]) {
|
|
702
|
-
_this._aggs[k] = function(a, c) {
|
|
703
|
-
var v = Array.from(new Set(a.map(c)));
|
|
704
|
-
return v.length === 1 ? v[0] : v;
|
|
705
|
-
};
|
|
706
|
-
}
|
|
707
|
-
return accessor(k);
|
|
708
|
-
}
|
|
709
|
-
}), this;
|
|
710
|
-
}
|
|
711
|
-
},
|
|
712
|
-
{
|
|
713
|
-
/**
|
|
714
|
-
The list of nodes to be used for drawing the network. The value passed should either be an *Array* of data or a *String* representing a filepath or URL to be loaded.
|
|
715
|
-
|
|
716
|
-
Additionally, a custom formatting function can be passed as a second argument to this method. This custom function will be passed the data that has been loaded, as long as there are no errors. This function should return the final node *Array*.
|
|
717
|
-
@param f Array of node objects or a URL to load nodes from.
|
|
718
|
-
*/ key: "nodes",
|
|
719
|
-
value: function nodes(_, f) {
|
|
720
|
-
if (arguments.length) {
|
|
721
|
-
addToQueue.bind(this)(_, f, "nodes");
|
|
722
|
-
return this;
|
|
723
|
-
}
|
|
724
|
-
return this._nodes;
|
|
725
|
-
}
|
|
726
|
-
},
|
|
727
|
-
{
|
|
728
|
-
/**
|
|
729
|
-
The size accessor for each node in the network.
|
|
730
|
-
*/ key: "size",
|
|
731
|
-
value: function size(_) {
|
|
732
|
-
return arguments.length ? (this._size = typeof _ === "function" || !_ ? _ : accessor(_), this) : this._size;
|
|
733
|
-
}
|
|
734
|
-
},
|
|
735
|
-
{
|
|
736
|
-
/**
|
|
737
|
-
Defines the maximum pixel radius used in size scaling. By default, the maximum size is determined by half the distance of the two closest nodes.
|
|
738
|
-
*/ key: "sizeMax",
|
|
739
|
-
value: function sizeMax(_) {
|
|
740
|
-
return arguments.length ? (this._sizeMax = _, this) : this._sizeMax;
|
|
741
|
-
}
|
|
742
|
-
},
|
|
743
|
-
{
|
|
744
|
-
/**
|
|
745
|
-
Defines the minimum pixel radius used in size scaling.
|
|
746
|
-
*/ key: "sizeMin",
|
|
747
|
-
value: function sizeMin(_) {
|
|
748
|
-
return arguments.length ? (this._sizeMin = _, this) : this._sizeMin;
|
|
749
|
-
}
|
|
750
|
-
},
|
|
751
|
-
{
|
|
752
|
-
/**
|
|
753
|
-
The type of [continuous d3-scale](https://github.com/d3/d3-scale#continuous-scales) used when calculating the pixel size of nodes in the network.
|
|
754
|
-
*/ key: "sizeScale",
|
|
755
|
-
value: function sizeScale(_) {
|
|
756
|
-
return arguments.length ? (this._sizeScale = _, this) : this._sizeScale;
|
|
757
|
-
}
|
|
758
|
-
},
|
|
759
|
-
{
|
|
760
|
-
/**
|
|
761
|
-
The x position accessor for each node. The data passed to .data() takes priority over the .nodes() data array. By default, the x and y positions are determined dynamically based on default force layout properties.
|
|
762
|
-
*/ key: "x",
|
|
763
|
-
value: function x(_) {
|
|
764
|
-
if (arguments.length) {
|
|
765
|
-
if (typeof _ === "function") this._x = _;
|
|
766
|
-
else {
|
|
767
|
-
this._x = accessor(_);
|
|
768
|
-
if (!this._aggs[_]) this._aggs[_] = mean;
|
|
769
|
-
}
|
|
770
|
-
return this;
|
|
771
|
-
} else return this._x;
|
|
772
|
-
}
|
|
773
|
-
},
|
|
774
|
-
{
|
|
775
|
-
/**
|
|
776
|
-
The y position accessor for each node. The data passed to .data() takes priority over the .nodes() data array. By default, the x and y positions are determined dynamically based on default force layout properties.
|
|
777
|
-
*/ key: "y",
|
|
778
|
-
value: function y(_) {
|
|
779
|
-
if (arguments.length) {
|
|
780
|
-
if (typeof _ === "function") this._y = _;
|
|
781
|
-
else {
|
|
782
|
-
this._y = accessor(_);
|
|
783
|
-
if (!this._aggs[_]) this._aggs[_] = mean;
|
|
784
|
-
}
|
|
785
|
-
return this;
|
|
786
|
-
} else return this._y;
|
|
787
|
-
}
|
|
788
|
-
}
|
|
789
|
-
]);
|
|
790
|
-
return Network;
|
|
791
|
-
}(Viz);
|
|
792
|
-
/**
|
|
793
|
-
Creates a network visualization based on a defined set of nodes and edges. [Click here](http://d3plus.org/examples/d3plus-network/getting-started/) for help getting started using the Network class.
|
|
794
|
-
*/ export { Network as default };
|
|
795
|
-
|
|
796
|
-
//# sourceMappingURL=Network.js.map
|