@peter.prib/renderengine 0.0.0-stage → 0.2.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/LICENSE +21 -0
- package/README.md +203 -2
- package/REFERENCE.md +2198 -0
- package/dist/renderengine-workspace.umd.js +46905 -0
- package/dist/renderengine.umd.js +42223 -0
- package/examples/archimate.html +66 -0
- package/examples/diagram-editor.html +51 -0
- package/package.json +65 -4
- package/src/BaseRenderer.js +57 -0
- package/src/CanvasRenderer.js +194 -0
- package/src/Mat4.js +111 -0
- package/src/OrbitCamera.js +57 -0
- package/src/RendererFactory.js +50 -0
- package/src/SVGRenderer.js +439 -0
- package/src/archimate.js +723 -0
- package/src/archimateArchiFormat.js +1693 -0
- package/src/archimateArchiTypes.js +72 -0
- package/src/archimateArchive.js +140 -0
- package/src/archimateCSV.js +127 -0
- package/src/archimateDrawio.js +182 -0
- package/src/archimateExchangeFormat.js +546 -0
- package/src/archimateRelationshipTable.js +93 -0
- package/src/archimateSpecializations.js +161 -0
- package/src/chartCatalog.js +589 -0
- package/src/charting/ArchimateDiagramEditor.js +1624 -0
- package/src/charting/ArchimateSpecializationSelector.js +134 -0
- package/src/charting/Axis.js +68 -0
- package/src/charting/CameraSeeder.js +30 -0
- package/src/charting/CatalogDialog.js +92 -0
- package/src/charting/Chart.js +37 -0
- package/src/charting/Chart3D.js +99 -0
- package/src/charting/ChartBox.js +80 -0
- package/src/charting/ChartData.js +27 -0
- package/src/charting/ChartRegistry.js +76 -0
- package/src/charting/CheckboxTreeSelector.js +304 -0
- package/src/charting/ColorField.js +107 -0
- package/src/charting/ColorPalette.js +88 -0
- package/src/charting/CommandHistory.js +176 -0
- package/src/charting/DataFilter.js +52 -0
- package/src/charting/Diagram.js +36 -0
- package/src/charting/Diagram3D.js +29 -0
- package/src/charting/DiagramClipboard.js +31 -0
- package/src/charting/DiagramEditor.js +3330 -0
- package/src/charting/DiagramEditorCommand.js +110 -0
- package/src/charting/DiagramEditorCommands.js +237 -0
- package/src/charting/DiagramEditorEdgeCommands.js +142 -0
- package/src/charting/DiagramEditorState.js +98 -0
- package/src/charting/DiagramRegistry.js +86 -0
- package/src/charting/DiagramTypeRegistry.js +326 -0
- package/src/charting/DiagramViewPropertiesDialog.js +46 -0
- package/src/charting/Edge.js +113 -0
- package/src/charting/ErrorBars.js +37 -0
- package/src/charting/FilterSystem.js +285 -0
- package/src/charting/FindReplaceDialog.js +139 -0
- package/src/charting/FormDialog.js +385 -0
- package/src/charting/Gauge.js +58 -0
- package/src/charting/Hierarchy.js +175 -0
- package/src/charting/HintPanel.js +86 -0
- package/src/charting/ImageSelector.js +148 -0
- package/src/charting/InteractionManager.js +725 -0
- package/src/charting/Legend.js +58 -0
- package/src/charting/MenuBar.js +62 -0
- package/src/charting/ModelFileFormat.js +115 -0
- package/src/charting/OrbitControls.js +77 -0
- package/src/charting/Palette.js +119 -0
- package/src/charting/PopupMenu.js +117 -0
- package/src/charting/PropertiesPanel.js +155 -0
- package/src/charting/PropertyListEditor.js +96 -0
- package/src/charting/PropertyLog.js +92 -0
- package/src/charting/SettingsCascade.js +93 -0
- package/src/charting/SettingsDialog.js +53 -0
- package/src/charting/SettingsManager.js +179 -0
- package/src/charting/SettingsViewPropertiesDialog.js +58 -0
- package/src/charting/ShapePaths.js +27 -0
- package/src/charting/Statistics.js +134 -0
- package/src/charting/TemplateCatalog.js +59 -0
- package/src/charting/TemplateLibrary.js +103 -0
- package/src/charting/TextStyle.js +168 -0
- package/src/charting/ViewFit.js +55 -0
- package/src/charting/ViewMenu.js +70 -0
- package/src/charting/ViewPropertiesDialog.js +77 -0
- package/src/charting/ViewTabStrip.js +81 -0
- package/src/charting/archimate/ArchiFileFormat.js +32 -0
- package/src/charting/archimate/ArchimateCanvasEditor.js +815 -0
- package/src/charting/archimate/ArchimateCsvFileFormat.js +35 -0
- package/src/charting/archimate/ArchimateEdge.js +137 -0
- package/src/charting/archimate/ArchimateElementTemplate.js +195 -0
- package/src/charting/archimate/ArchimatePalette.js +102 -0
- package/src/charting/archimate/CsvImportDialog.js +105 -0
- package/src/charting/archimate/CustomViewpoints.js +74 -0
- package/src/charting/archimate/DerivedEdge.js +29 -0
- package/src/charting/archimate/DrawioFileFormat.js +24 -0
- package/src/charting/archimate/ElementFilterRule.js +21 -0
- package/src/charting/archimate/ExchangeFileFormat.js +28 -0
- package/src/charting/archimate/ViewGroupTemplate.js +137 -0
- package/src/charting/archimate/ViewLineEdge.js +84 -0
- package/src/charting/archimate/ViewpointRule.js +45 -0
- package/src/charting/archimate/archimateFileFormats.js +12 -0
- package/src/charting/archimate/archimateNames.js +5 -0
- package/src/charting/archimate/csvMapping.js +122 -0
- package/src/charting/archimate/elementMenuItems.js +32 -0
- package/src/charting/archimate/elementProperties.js +146 -0
- package/src/charting/archimate/elementTypeChoices.js +7 -0
- package/src/charting/archimate/elementTypeGroups.js +19 -0
- package/src/charting/archimate/index.js +17 -0
- package/src/charting/archimate/specializationCatalogDialog.js +64 -0
- package/src/charting/archimate/typeGlyph.js +29 -0
- package/src/charting/arrangement/Arrangement.js +112 -0
- package/src/charting/arrangement/ArrangementCommand.js +29 -0
- package/src/charting/arrangement/BackgroundCommand.js +41 -0
- package/src/charting/arrangement/BackgroundGroup.js +18 -0
- package/src/charting/arrangement/GroupCommand.js +46 -0
- package/src/charting/arrangement/ItemGroup.js +62 -0
- package/src/charting/arrangement/LockCommand.js +32 -0
- package/src/charting/arrangement/UngroupCommand.js +27 -0
- package/src/charting/arrangement/alignment.js +88 -0
- package/src/charting/arrangement/arrangeMenuItems.js +25 -0
- package/src/charting/arrangement/index.js +11 -0
- package/src/charting/arrangement/layouts.js +233 -0
- package/src/charting/canvas/ArchiHint.js +78 -0
- package/src/charting/canvas/CanvasBoxKind.js +39 -0
- package/src/charting/canvas/CanvasPalette.js +49 -0
- package/src/charting/canvas/CanvasTemplateLibrary.js +61 -0
- package/src/charting/canvas/CanvasTemplateMenu.js +151 -0
- package/src/charting/canvas/EditHintCommand.js +28 -0
- package/src/charting/canvas/canvasBoxKinds.js +27 -0
- package/src/charting/canvas/canvasBoxMenuItems.js +40 -0
- package/src/charting/canvas/defaultCanvasTemplates.js +186 -0
- package/src/charting/canvas/diagramBoxKinds.js +12 -0
- package/src/charting/canvas/hintMenuItems.js +49 -0
- package/src/charting/charts/ArcGauge.js +55 -0
- package/src/charting/charts/AreaChart.js +71 -0
- package/src/charting/charts/BarChart.js +80 -0
- package/src/charting/charts/BarChart3D.js +56 -0
- package/src/charting/charts/BarChart3DOrbit.js +53 -0
- package/src/charting/charts/BarChartBase.js +70 -0
- package/src/charting/charts/BarGauge.js +42 -0
- package/src/charting/charts/BoxPlotChart.js +41 -0
- package/src/charting/charts/BubbleChart.js +99 -0
- package/src/charting/charts/BubbleChart3D.js +78 -0
- package/src/charting/charts/BulletGauge.js +87 -0
- package/src/charting/charts/CalendarHeatmapChart.js +204 -0
- package/src/charting/charts/CandlestickChart.js +54 -0
- package/src/charting/charts/ChordDiagram.js +130 -0
- package/src/charting/charts/DensityChart.js +73 -0
- package/src/charting/charts/DialGauge.js +65 -0
- package/src/charting/charts/DonutChart.js +15 -0
- package/src/charting/charts/FunnelChart.js +47 -0
- package/src/charting/charts/GanttChart.js +201 -0
- package/src/charting/charts/GaugeChart.js +175 -0
- package/src/charting/charts/GeoMapChart.js +146 -0
- package/src/charting/charts/GroupedBarChart.js +88 -0
- package/src/charting/charts/GroupedDistributionChart.js +70 -0
- package/src/charting/charts/HeatmapChart.js +80 -0
- package/src/charting/charts/HierarchyChart.js +39 -0
- package/src/charting/charts/HistogramChart.js +45 -0
- package/src/charting/charts/KpiTile.js +72 -0
- package/src/charting/charts/LagPlotChart.js +41 -0
- package/src/charting/charts/LineChart.js +124 -0
- package/src/charting/charts/MultiRingGauge.js +54 -0
- package/src/charting/charts/OutlineChart.js +95 -0
- package/src/charting/charts/ParallelCoordinatesChart.js +130 -0
- package/src/charting/charts/PieChart.js +56 -0
- package/src/charting/charts/PipeChart.js +88 -0
- package/src/charting/charts/PopulationPyramidChart.js +106 -0
- package/src/charting/charts/QQPlotChart.js +64 -0
- package/src/charting/charts/RadarChart.js +76 -0
- package/src/charting/charts/RadialBarChart.js +96 -0
- package/src/charting/charts/RingGauge.js +23 -0
- package/src/charting/charts/SankeyDiagram.js +174 -0
- package/src/charting/charts/ScatterChart.js +104 -0
- package/src/charting/charts/StackedAreaChart.js +15 -0
- package/src/charting/charts/StackedBarChart.js +33 -0
- package/src/charting/charts/StackedBarChart3DOrbit.js +58 -0
- package/src/charting/charts/StreamGraphChart.js +131 -0
- package/src/charting/charts/SunburstChart.js +57 -0
- package/src/charting/charts/ThermometerGauge.js +43 -0
- package/src/charting/charts/TreemapChart.js +54 -0
- package/src/charting/charts/ViolinChart.js +37 -0
- package/src/charting/charts/WaterfallChart.js +66 -0
- package/src/charting/charts/WordCloudChart.js +104 -0
- package/src/charting/diagramModel/AddViewCommand.js +33 -0
- package/src/charting/diagramModel/DiagramModel.js +39 -0
- package/src/charting/diagramModel/DiagramModelSearch.js +22 -0
- package/src/charting/diagramModel/DiagramView.js +50 -0
- package/src/charting/diagramModel/ModelHistory.js +43 -0
- package/src/charting/diagramModel/ModelReport.js +153 -0
- package/src/charting/diagramModel/ModelSearch.js +223 -0
- package/src/charting/diagramModel/RemoveViewCommand.js +25 -0
- package/src/charting/diagramModel/RenameViewCommand.js +21 -0
- package/src/charting/diagramModel/ReplaceTextCommand.js +25 -0
- package/src/charting/diagramModel/ViewSetChecker.js +34 -0
- package/src/charting/diagramModel/ViewSetModel.js +243 -0
- package/src/charting/diagramModel/index.js +6 -0
- package/src/charting/diagramModel/nameTransforms.js +29 -0
- package/src/charting/diagrams/ArchimateCommands.js +141 -0
- package/src/charting/diagrams/ArchimateDiagram.js +263 -0
- package/src/charting/diagrams/ArchimateModel.js +1155 -0
- package/src/charting/diagrams/ArchimateModelChecker.js +125 -0
- package/src/charting/diagrams/ArchimateModelReport.js +128 -0
- package/src/charting/diagrams/ArchimateModelSearch.js +41 -0
- package/src/charting/diagrams/ArchimateValidator.js +357 -0
- package/src/charting/diagrams/CanvasView.js +112 -0
- package/src/charting/diagrams/ContextMenu.js +37 -0
- package/src/charting/diagrams/DataModelDiagram.js +86 -0
- package/src/charting/diagrams/DataModelRelationshipStrategy.js +38 -0
- package/src/charting/diagrams/DerivedRelationships.js +102 -0
- package/src/charting/diagrams/EbnfDiagram.js +39 -0
- package/src/charting/diagrams/EdgeGeometry.js +553 -0
- package/src/charting/diagrams/EditViewItemCommand.js +128 -0
- package/src/charting/diagrams/ElementInstance.js +157 -0
- package/src/charting/diagrams/GraphDiagram.js +1340 -0
- package/src/charting/diagrams/GraphDiagram3D.js +152 -0
- package/src/charting/diagrams/GraphMetrics.js +81 -0
- package/src/charting/diagrams/GridOverlay.js +137 -0
- package/src/charting/diagrams/ImportRowsCommand.js +62 -0
- package/src/charting/diagrams/LabelHelper.js +108 -0
- package/src/charting/diagrams/MergeElementsCommand.js +101 -0
- package/src/charting/diagrams/NestInstanceCommand.js +34 -0
- package/src/charting/diagrams/NodeGeometry.js +158 -0
- package/src/charting/diagrams/PlaceItemsCommand.js +77 -0
- package/src/charting/diagrams/RadialLayout.js +101 -0
- package/src/charting/diagrams/RelationshipInstance.js +93 -0
- package/src/charting/diagrams/RemoveGroupFromViewCommand.js +28 -0
- package/src/charting/diagrams/RemoveLineCommand.js +27 -0
- package/src/charting/diagrams/ShowElementCommand.js +43 -0
- package/src/charting/diagrams/SvgCoordinate.js +17 -0
- package/src/charting/diagrams/SvgZoom.js +127 -0
- package/src/charting/diagrams/Tooltip.js +62 -0
- package/src/charting/diagrams/ViewConnectionInstance.js +102 -0
- package/src/charting/diagrams/ViewObjectInstance.js +56 -0
- package/src/charting/diagrams/commands/AddEdgeCommand.js +34 -0
- package/src/charting/diagrams/commands/AddNodeCommand.js +28 -0
- package/src/charting/diagrams/commands/AddWaypointCommand.js +27 -0
- package/src/charting/diagrams/commands/CreateFolderCommand.js +27 -0
- package/src/charting/diagrams/commands/DeleteEdgeCommand.js +30 -0
- package/src/charting/diagrams/commands/DeleteFolderCommand.js +47 -0
- package/src/charting/diagrams/commands/DeleteNodeCommand.js +35 -0
- package/src/charting/diagrams/commands/DeleteWaypointCommand.js +24 -0
- package/src/charting/diagrams/commands/GraphCommand.js +65 -0
- package/src/charting/diagrams/commands/InvertEdgeCommand.js +24 -0
- package/src/charting/diagrams/commands/MoveNodeCommand.js +44 -0
- package/src/charting/diagrams/commands/MoveWaypointCommand.js +27 -0
- package/src/charting/diagrams/commands/RenameEdgeCommand.js +23 -0
- package/src/charting/diagrams/commands/RenameFolderCommand.js +31 -0
- package/src/charting/diagrams/commands/RenameNodeCommand.js +27 -0
- package/src/charting/diagrams/commands/ResizeNodeCommand.js +46 -0
- package/src/charting/diagrams/commands/UpdateEdgeSideCommand.js +40 -0
- package/src/charting/diagrams/commands/index.js +17 -0
- package/src/charting/diagrams/duplicates.js +49 -0
- package/src/charting/diagrams/nesting.js +30 -0
- package/src/charting/diagrams/roadmap.js +77 -0
- package/src/charting/edgeMarkers/ArrowMarker.js +15 -0
- package/src/charting/edgeMarkers/CircleMarker.js +13 -0
- package/src/charting/edgeMarkers/CrowsFootMarker.js +16 -0
- package/src/charting/edgeMarkers/DiamondMarker.js +15 -0
- package/src/charting/edgeMarkers/EdgeMarker.js +34 -0
- package/src/charting/edgeMarkers/HalfArrowMarker.js +8 -0
- package/src/charting/edgeMarkers/HollowDiamondMarker.js +18 -0
- package/src/charting/edgeMarkers/HollowTriangleMarker.js +18 -0
- package/src/charting/edgeMarkers/OpenArrowMarker.js +17 -0
- package/src/charting/edgeMarkers/index.js +27 -0
- package/src/charting/edgeStyle/EdgeStyleCascade.js +22 -0
- package/src/charting/edgeStyle/EdgeStyleDialog.js +51 -0
- package/src/charting/edgeStyle/EdgeStyleSchema.js +43 -0
- package/src/charting/edgeStyle/SetStyleCommand.js +12 -0
- package/src/charting/edgeStyle/index.js +4 -0
- package/src/charting/emphasis/EmphasisRule.js +42 -0
- package/src/charting/emphasis/HighlightRule.js +24 -0
- package/src/charting/gauges/ArcTrack.js +51 -0
- package/src/charting/gauges/GaugeAnimation.js +51 -0
- package/src/charting/gauges/GaugeBands.js +48 -0
- package/src/charting/gauges/GaugeScale.js +87 -0
- package/src/charting/gauges/GaugeTrack.js +44 -0
- package/src/charting/gauges/GaugeValue.js +61 -0
- package/src/charting/gauges/HorizontalTrack.js +14 -0
- package/src/charting/gauges/LinearTrack.js +29 -0
- package/src/charting/gauges/Sparkline.js +42 -0
- package/src/charting/gauges/VerticalTrack.js +17 -0
- package/src/charting/glyphs/ArrowGlyph.js +21 -0
- package/src/charting/glyphs/BatteryGlyph.js +18 -0
- package/src/charting/glyphs/ChevronGlyph.js +18 -0
- package/src/charting/glyphs/CircleGlyph.js +15 -0
- package/src/charting/glyphs/CloudGlyph.js +19 -0
- package/src/charting/glyphs/ComponentGlyph.js +18 -0
- package/src/charting/glyphs/ConstraintGlyph.js +24 -0
- package/src/charting/glyphs/ContractBoxGlyph.js +10 -0
- package/src/charting/glyphs/CubeGlyph.js +19 -0
- package/src/charting/glyphs/CylinderGlyph.js +19 -0
- package/src/charting/glyphs/DashedDoubleArrowGlyph.js +11 -0
- package/src/charting/glyphs/DeviceGlyph.js +17 -0
- package/src/charting/glyphs/DiamondGlyph.js +17 -0
- package/src/charting/glyphs/DocumentGlyph.js +17 -0
- package/src/charting/glyphs/DoubleArrowGlyph.js +23 -0
- package/src/charting/glyphs/DoubleCircleGlyph.js +24 -0
- package/src/charting/glyphs/EllipseGlyph.js +18 -0
- package/src/charting/glyphs/FactoryGlyph.js +20 -0
- package/src/charting/glyphs/FlagGlyph.js +16 -0
- package/src/charting/glyphs/GapCircleGlyph.js +17 -0
- package/src/charting/glyphs/GearGlyph.js +37 -0
- package/src/charting/glyphs/Glyph.js +98 -0
- package/src/charting/glyphs/GroupingBoxGlyph.js +13 -0
- package/src/charting/glyphs/HalfCircleGlyph.js +22 -0
- package/src/charting/glyphs/HexagonGlyph.js +28 -0
- package/src/charting/glyphs/IconGlyph.js +22 -0
- package/src/charting/glyphs/ImageGlyph.js +16 -0
- package/src/charting/glyphs/JunctionGlyph.js +17 -0
- package/src/charting/glyphs/LollipopGlyph.js +22 -0
- package/src/charting/glyphs/MagnifierGlyph.js +17 -0
- package/src/charting/glyphs/NoteGlyph.js +33 -0
- package/src/charting/glyphs/ObjectBoxGlyph.js +21 -0
- package/src/charting/glyphs/OrJunctionGlyph.js +17 -0
- package/src/charting/glyphs/ParallelogramGlyph.js +20 -0
- package/src/charting/glyphs/PersonGlyph.js +23 -0
- package/src/charting/glyphs/PillGlyph.js +23 -0
- package/src/charting/glyphs/PinGlyph.js +18 -0
- package/src/charting/glyphs/PrincipleGlyph.js +23 -0
- package/src/charting/glyphs/ProductBoxGlyph.js +16 -0
- package/src/charting/glyphs/RectGlyph.js +15 -0
- package/src/charting/glyphs/RoundedBoxGlyph.js +13 -0
- package/src/charting/glyphs/StackGlyph.js +14 -0
- package/src/charting/glyphs/StepsGlyph.js +20 -0
- package/src/charting/glyphs/StickFigureGlyph.js +32 -0
- package/src/charting/glyphs/SystemSoftwareBoxGlyph.js +16 -0
- package/src/charting/glyphs/TabbedBoxGlyph.js +37 -0
- package/src/charting/glyphs/TargetGlyph.js +23 -0
- package/src/charting/glyphs/WavyBoxGlyph.js +17 -0
- package/src/charting/glyphs/WheelGlyph.js +28 -0
- package/src/charting/glyphs/drawGlyph.js +28 -0
- package/src/charting/glyphs/glyphSvg.js +55 -0
- package/src/charting/glyphs/index.js +109 -0
- package/src/charting/modelTree/AnalysisPanel.js +159 -0
- package/src/charting/modelTree/DiagramTabs.js +217 -0
- package/src/charting/modelTree/ModelTree.js +164 -0
- package/src/charting/modelTree/ModelTreePanel.js +914 -0
- package/src/charting/modelTree/TreeBuilder.js +238 -0
- package/src/charting/modelTree/TreeModeRegistry.js +51 -0
- package/src/charting/modelTree/TreeViewMode.js +110 -0
- package/src/charting/modelTree/buildFilterTrees.js +138 -0
- package/src/charting/modelTree/modes/FlatTreeMode.js +46 -0
- package/src/charting/modelTree/modes/LayerGroupedTreeMode.js +62 -0
- package/src/charting/modelTree/modes/TypeGroupedTreeMode.js +60 -0
- package/src/charting/modelTree/treeLayers.js +11 -0
- package/src/charting/report/reportHtml.js +82 -0
- package/src/charting/report/reportViewer.js +118 -0
- package/src/charting/shapes/CircleShape.js +19 -0
- package/src/charting/shapes/PathShape.js +17 -0
- package/src/charting/shapes/RectShape.js +20 -0
- package/src/charting/shapes/Shape.js +20 -0
- package/src/charting/shapes/ShapeFactory.js +23 -0
- package/src/charting/storage/LocalJsonStore.js +43 -0
- package/src/charting/templates/ActorTemplate.js +36 -0
- package/src/charting/templates/BoxTemplate.js +27 -0
- package/src/charting/templates/CircleTemplate.js +18 -0
- package/src/charting/templates/ClassTemplate.js +20 -0
- package/src/charting/templates/CloudTemplate.js +43 -0
- package/src/charting/templates/ComponentTemplate.js +19 -0
- package/src/charting/templates/CylinderTemplate.js +30 -0
- package/src/charting/templates/DataStoreTemplate.js +16 -0
- package/src/charting/templates/DiamondTemplate.js +10 -0
- package/src/charting/templates/DocumentTemplate.js +32 -0
- package/src/charting/templates/EllipseTemplate.js +15 -0
- package/src/charting/templates/FinalStateTemplate.js +12 -0
- package/src/charting/templates/GlyphTemplate.js +47 -0
- package/src/charting/templates/HexagonTemplate.js +17 -0
- package/src/charting/templates/LifelineTemplate.js +20 -0
- package/src/charting/templates/ManualInputTemplate.js +12 -0
- package/src/charting/templates/NoteTemplate.js +23 -0
- package/src/charting/templates/OctagonTemplate.js +7 -0
- package/src/charting/templates/PackageTemplate.js +25 -0
- package/src/charting/templates/ParallelogramTemplate.js +11 -0
- package/src/charting/templates/PentagonTemplate.js +5 -0
- package/src/charting/templates/PolygonTemplate.js +18 -0
- package/src/charting/templates/PredefinedProcessTemplate.js +13 -0
- package/src/charting/templates/RectangleTemplate.js +28 -0
- package/src/charting/templates/RegularPolygonTemplate.js +21 -0
- package/src/charting/templates/RoundedRectangleTemplate.js +5 -0
- package/src/charting/templates/StadiumTemplate.js +8 -0
- package/src/charting/templates/StarTemplate.js +17 -0
- package/src/charting/templates/SwimlaneTemplate.js +18 -0
- package/src/charting/templates/Template.js +208 -0
- package/src/charting/templates/TrapezoidTemplate.js +11 -0
- package/src/charting/templates/TriangleTemplate.js +12 -0
- package/src/charting/templates/index.js +31 -0
- package/src/charting/templates/outline.js +59 -0
- package/src/charting/templates/svg.js +19 -0
- package/src/charting/textToShapes.js +61 -0
- package/src/charting/toolbar/ToolbarButton.js +38 -0
- package/src/charting/toolbar/ToolbarCheckbox.js +31 -0
- package/src/charting/toolbar/ToolbarItem.js +19 -0
- package/src/charting/toolbar/ToolbarMenu.js +36 -0
- package/src/charting/toolbar/ToolbarSelect.js +38 -0
- package/src/charting/toolbar/ToolbarSeparator.js +7 -0
- package/src/charting/toolbar/ToolbarText.js +22 -0
- package/src/charting/toolbar/index.js +8 -0
- package/src/charting/toolbar/pickFile.js +14 -0
- package/src/charting/viewDecorations.js +85 -0
- package/src/charting/zOrder.js +57 -0
- package/src/csvTable.js +61 -0
- package/src/datamodel.js +122 -0
- package/src/datawindow/BoundedWindow.js +36 -0
- package/src/datawindow/FlatDataWindow.js +34 -0
- package/src/datawindow/GraphDataWindow.js +40 -0
- package/src/datawindow/GroupedSampleDataWindow.js +16 -0
- package/src/datawindow/SeriesDataWindow.js +42 -0
- package/src/datawindow/index.js +31 -0
- package/src/diagramCatalog.js +30 -0
- package/src/ebnfDiagram.js +57 -0
- package/src/ebnfParser.js +129 -0
- package/src/exportImage.js +233 -0
- package/src/index.js +2636 -0
- package/src/itIcons.js +84 -0
- package/src/kernelExpr.js +243 -0
- package/src/propertiesDialog.js +463 -0
- package/src/railroadDiagram.js +571 -0
- package/src/treeModeCatalog.js +16 -0
- package/src/workspace/ContextBus.js +79 -0
- package/src/workspace/EditorShell.js +67 -0
- package/src/workspace/Part.js +163 -0
- package/src/workspace/PartFactory.js +49 -0
- package/src/workspace/PartRegistry.js +86 -0
- package/src/workspace/Workspace.js +321 -0
- package/src/workspace/archimateServices.js +33 -0
- package/src/workspace/dom.js +120 -0
- package/src/workspace/index.js +75 -0
- package/src/workspace/layout/GridNode.js +280 -0
- package/src/workspace/layout/LayoutNode.js +89 -0
- package/src/workspace/layout/PartNode.js +77 -0
- package/src/workspace/layout/SplitNode.js +114 -0
- package/src/workspace/layout/TabsNode.js +191 -0
- package/src/workspace/layout/index.js +24 -0
- package/src/workspace/parts/AdapterPart.js +33 -0
- package/src/workspace/parts/ArchimateCanvasPart.js +345 -0
- package/src/workspace/parts/ArchimateEditorPart.js +79 -0
- package/src/workspace/parts/ChartPart.js +115 -0
- package/src/workspace/parts/ContentPart.js +34 -0
- package/src/workspace/parts/DetailPart.js +46 -0
- package/src/workspace/parts/DiagramEditorPart.js +135 -0
- package/src/workspace/parts/EditorPart.js +388 -0
- package/src/workspace/parts/HtmlPart.js +25 -0
- package/src/workspace/parts/ListPart.js +57 -0
- package/src/workspace/parts/ModelFile.js +187 -0
- package/src/workspace/parts/ModelsPart.js +135 -0
- package/src/workspace/styles.js +258 -0
- package/src/workspace/themes.js +96 -0
- package/src/workspace/workArea.js +413 -0
- package/src/workspace/workAreaModel.js +197 -0
- package/src/workspace.js +16 -0
- package/src/zip/ZipArchive.js +160 -0
- package/src/zip/crc32.js +25 -0
- package/src/zip/inflate.js +159 -0
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { Chart } from '../Chart.js';
|
|
2
|
+
import { ColorPalette } from '../ColorPalette.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* CalendarHeatmapChart — a year-at-a-glance day grid (GitHub-contribution-graph
|
|
6
|
+
* style). Each cell is one day, shaded by its value along a continuous color
|
|
7
|
+
* scale. Days with no data use the empty color.
|
|
8
|
+
*
|
|
9
|
+
* Data: Array<{date: string|Date, value: number}>
|
|
10
|
+
* Options:
|
|
11
|
+
* - year: number (defaults to current year; ignored if startDate/endDate set)
|
|
12
|
+
* - startDate, endDate: string|Date (inclusive bounds)
|
|
13
|
+
* - colorScale: string[] low→high stops (default GitHub-like greens)
|
|
14
|
+
* - emptyColor: string for days with no data
|
|
15
|
+
* - cellSize: number (auto-sized to fit box if omitted)
|
|
16
|
+
* - cellGap: number (default 2)
|
|
17
|
+
* - showValues: boolean (default false)
|
|
18
|
+
* - title: string
|
|
19
|
+
* - monthLabels: boolean (default true)
|
|
20
|
+
* - weekdayLabels: boolean (default true)
|
|
21
|
+
* - weekStart: 0 = Sunday, 1 = Monday (default 0)
|
|
22
|
+
*/
|
|
23
|
+
export class CalendarHeatmapChart extends Chart {
|
|
24
|
+
static chartType = 'calendarHeatmap';
|
|
25
|
+
|
|
26
|
+
/** Parse an ISO date string or Date into a UTC midnight Date. */
|
|
27
|
+
static parseDate(d) {
|
|
28
|
+
if (d instanceof Date) return new Date(Date.UTC(d.getFullYear(), d.getMonth(), d.getDate()));
|
|
29
|
+
if (typeof d === 'string') {
|
|
30
|
+
// Accept 'YYYY-MM-DD' or full ISO; normalise to UTC midnight.
|
|
31
|
+
const [y, m, day] = d.split('T')[0].split('-').map(Number);
|
|
32
|
+
return new Date(Date.UTC(y, m - 1, day));
|
|
33
|
+
}
|
|
34
|
+
return new Date(NaN);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
static addDays(date, days) {
|
|
38
|
+
const r = new Date(date);
|
|
39
|
+
r.setUTCDate(r.getUTCDate() + days);
|
|
40
|
+
return r;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
static diffDays(a, b) {
|
|
44
|
+
return Math.round((a.getTime() - b.getTime()) / 86400000);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
static startOfWeek(date, weekStart = 0) {
|
|
48
|
+
const day = date.getUTCDay();
|
|
49
|
+
const offset = (day - weekStart + 7) % 7;
|
|
50
|
+
return CalendarHeatmapChart.addDays(date, -offset);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
static isoString(date) {
|
|
54
|
+
return date.toISOString().slice(0, 10);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
_render() {
|
|
58
|
+
const data = this.data || [];
|
|
59
|
+
const options = this.options || {};
|
|
60
|
+
const w = this.renderer?.width ?? 800;
|
|
61
|
+
const h = this.renderer?.height ?? 400;
|
|
62
|
+
|
|
63
|
+
const now = new Date();
|
|
64
|
+
const defaultYear = now.getFullYear();
|
|
65
|
+
const {
|
|
66
|
+
x = 60, y = 40,
|
|
67
|
+
year = defaultYear,
|
|
68
|
+
startDate: startDateOpt,
|
|
69
|
+
endDate: endDateOpt,
|
|
70
|
+
colorScale = ['#ebedf0', '#9be9a8', '#40c463', '#30a14e', '#216e39'],
|
|
71
|
+
emptyColor = '#ebedf0',
|
|
72
|
+
cellSize,
|
|
73
|
+
cellGap = 2,
|
|
74
|
+
showValues = false,
|
|
75
|
+
title,
|
|
76
|
+
monthLabels = true,
|
|
77
|
+
weekdayLabels = true,
|
|
78
|
+
weekStart = 0,
|
|
79
|
+
} = options;
|
|
80
|
+
|
|
81
|
+
const valueByDay = new Map();
|
|
82
|
+
const allValues = [];
|
|
83
|
+
for (const d of data) {
|
|
84
|
+
const date = CalendarHeatmapChart.parseDate(d.date);
|
|
85
|
+
if (Number.isNaN(date.getTime())) continue;
|
|
86
|
+
const key = CalendarHeatmapChart.isoString(date);
|
|
87
|
+
const value = typeof d.value === 'number' ? d.value : Number(d.value);
|
|
88
|
+
valueByDay.set(key, value);
|
|
89
|
+
allValues.push(value);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
let start, end;
|
|
93
|
+
if (startDateOpt != null && endDateOpt != null) {
|
|
94
|
+
start = CalendarHeatmapChart.parseDate(startDateOpt);
|
|
95
|
+
end = CalendarHeatmapChart.parseDate(endDateOpt);
|
|
96
|
+
} else if (startDateOpt != null) {
|
|
97
|
+
start = CalendarHeatmapChart.parseDate(startDateOpt);
|
|
98
|
+
end = CalendarHeatmapChart.addDays(start, 364);
|
|
99
|
+
} else if (endDateOpt != null) {
|
|
100
|
+
end = CalendarHeatmapChart.parseDate(endDateOpt);
|
|
101
|
+
start = CalendarHeatmapChart.addDays(end, -364);
|
|
102
|
+
} else {
|
|
103
|
+
start = new Date(Date.UTC(year, 0, 1));
|
|
104
|
+
end = new Date(Date.UTC(year, 11, 31));
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Always start on the configured week-start day so rows line up.
|
|
108
|
+
start = CalendarHeatmapChart.startOfWeek(start, weekStart);
|
|
109
|
+
end = CalendarHeatmapChart.startOfWeek(CalendarHeatmapChart.addDays(end, 6), weekStart);
|
|
110
|
+
end = CalendarHeatmapChart.addDays(end, 6); // inclusive end of that week
|
|
111
|
+
|
|
112
|
+
const days = CalendarHeatmapChart.diffDays(end, start) + 1;
|
|
113
|
+
const weeks = Math.ceil(days / 7);
|
|
114
|
+
|
|
115
|
+
const textAnchor = this.renderer.centerTextAnchor;
|
|
116
|
+
const labelWidth = weekdayLabels ? 32 : 0;
|
|
117
|
+
const headerHeight = monthLabels ? 24 : 0;
|
|
118
|
+
const titleHeight = title ? 30 : 0;
|
|
119
|
+
|
|
120
|
+
const availW = w - x - 20;
|
|
121
|
+
const availH = h - y - 20 - headerHeight - titleHeight;
|
|
122
|
+
const computedCellSize = cellSize ?? Math.min(
|
|
123
|
+
Math.floor((availW - labelWidth - cellGap * (weeks - 1)) / weeks),
|
|
124
|
+
Math.floor((availH - cellGap * 6) / 7),
|
|
125
|
+
);
|
|
126
|
+
const size = Math.max(4, computedCellSize);
|
|
127
|
+
const step = size + cellGap;
|
|
128
|
+
|
|
129
|
+
const gridX = x + labelWidth;
|
|
130
|
+
const gridY = y + headerHeight + titleHeight;
|
|
131
|
+
const gridW = weeks * step - cellGap;
|
|
132
|
+
const gridH = 7 * step - cellGap;
|
|
133
|
+
|
|
134
|
+
if (title) {
|
|
135
|
+
this.renderer.text(title, x, y + 16, { textAnchor: 'start', fontSize: '16px', fill: '#333' });
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const vMin = allValues.length ? Math.min(...allValues) : 0;
|
|
139
|
+
const vMax = allValues.length ? Math.max(...allValues) : 1;
|
|
140
|
+
|
|
141
|
+
const dayNames = weekStart === 1
|
|
142
|
+
? ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
|
|
143
|
+
: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
|
|
144
|
+
|
|
145
|
+
if (weekdayLabels) {
|
|
146
|
+
dayNames.forEach((name, i) => {
|
|
147
|
+
if (i % 2 === 0) {
|
|
148
|
+
this.renderer.text(name, x + labelWidth - 6, gridY + i * step + size / 2 + 4, {
|
|
149
|
+
textAnchor: 'end', fontSize: '10px', fill: '#666',
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// Month labels centered under the first week that contains that month.
|
|
156
|
+
if (monthLabels) {
|
|
157
|
+
const monthFormat = new Intl.DateTimeFormat('en-US', { month: 'short', timeZone: 'UTC' });
|
|
158
|
+
let lastMonth = -1;
|
|
159
|
+
for (let i = 0; i < days; i++) {
|
|
160
|
+
const date = CalendarHeatmapChart.addDays(start, i);
|
|
161
|
+
const month = date.getUTCMonth();
|
|
162
|
+
if (month !== lastMonth) {
|
|
163
|
+
lastMonth = month;
|
|
164
|
+
const week = Math.floor(i / 7);
|
|
165
|
+
this.renderer.text(monthFormat.format(date), gridX + week * step + size / 2, gridY - 8, {
|
|
166
|
+
textAnchor, fontSize: '10px', fill: '#666',
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
for (let i = 0; i < days; i++) {
|
|
173
|
+
const date = CalendarHeatmapChart.addDays(start, i);
|
|
174
|
+
const key = CalendarHeatmapChart.isoString(date);
|
|
175
|
+
const value = valueByDay.get(key);
|
|
176
|
+
const hasValue = valueByDay.has(key);
|
|
177
|
+
const week = Math.floor(i / 7);
|
|
178
|
+
const day = i % 7;
|
|
179
|
+
const cx = gridX + week * step;
|
|
180
|
+
const cy = gridY + day * step;
|
|
181
|
+
const color = hasValue
|
|
182
|
+
? ColorPalette.scaleColor(colorScale, vMin, vMax, value)
|
|
183
|
+
: emptyColor;
|
|
184
|
+
|
|
185
|
+
this.renderer.rect(cx, cy, size, size, color, null, {
|
|
186
|
+
tooltip: hasValue ? `${key}: ${value}` : `${key}: no data`,
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
if (showValues && hasValue && size >= 14) {
|
|
190
|
+
this.renderer.text(String(value), cx + size / 2, cy + size / 2 + 4, {
|
|
191
|
+
textAnchor, verticalAlign: 'middle', fontSize: '9px', fill: ColorPalette.isDark(color) ? '#fff' : '#333',
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// Legend.
|
|
197
|
+
const legendY = gridY + gridH + 24;
|
|
198
|
+
this.renderer.text('Less', x, legendY + 8, { textAnchor: 'start', fontSize: '10px', fill: '#666' });
|
|
199
|
+
colorScale.forEach((c, i) => {
|
|
200
|
+
this.renderer.rect(x + 30 + i * (size + 4), legendY, size, size, c);
|
|
201
|
+
});
|
|
202
|
+
this.renderer.text('More', x + 30 + colorScale.length * (size + 4) + 4, legendY + 8, { textAnchor: 'start', fontSize: '10px', fill: '#666' });
|
|
203
|
+
}
|
|
204
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Chart } from '../Chart.js';
|
|
2
|
+
import { ChartBox, ChartLabels } from '../ChartBox.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* CandlestickChart — OHLC financial chart. Each entry draws a vertical wick
|
|
6
|
+
* from low to high and a rectangular body from open to close.
|
|
7
|
+
*/
|
|
8
|
+
export class CandlestickChart extends Chart {
|
|
9
|
+
static chartType = 'candlestick';
|
|
10
|
+
|
|
11
|
+
_render() {
|
|
12
|
+
const data = this.data;
|
|
13
|
+
const options = this.options;
|
|
14
|
+
const box = ChartBox.fromRenderer(this.renderer);
|
|
15
|
+
const {
|
|
16
|
+
x = box.x, y = box.y, width = box.width, height = box.height,
|
|
17
|
+
upColor = '#26a69a', downColor = '#ef5350', title, xAxisLabel, yAxisLabel,
|
|
18
|
+
markers = [],
|
|
19
|
+
} = options;
|
|
20
|
+
|
|
21
|
+
const vMax = Math.max(...data.map(d => d.high));
|
|
22
|
+
const vMin = Math.min(...data.map(d => d.low));
|
|
23
|
+
const range = (vMax - vMin) || 1;
|
|
24
|
+
const slotWidth = width / data.length;
|
|
25
|
+
const bodyWidth = slotWidth * 0.6;
|
|
26
|
+
const toY = (v) => y + height - ((v - vMin) / range) * height;
|
|
27
|
+
const textAnchor = this.renderer.centerTextAnchor;
|
|
28
|
+
|
|
29
|
+
new ChartLabels({ title, xAxisLabel, yAxisLabel }).draw(this.renderer, { x, y, width, height });
|
|
30
|
+
this.renderer.path(`M${x},${y} L${x},${y + height} L${x + width},${y + height}`, 'none', { color: 'black', width: 1 });
|
|
31
|
+
|
|
32
|
+
data.forEach((d, i) => {
|
|
33
|
+
const cx = x + i * slotWidth + slotWidth / 2;
|
|
34
|
+
const isUp = d.close >= d.open;
|
|
35
|
+
const color = isUp ? upColor : downColor;
|
|
36
|
+
this.renderer.path(`M${cx},${toY(d.high)} L${cx},${toY(d.low)}`, 'none', { color, width: 1 });
|
|
37
|
+
const bodyTop = toY(Math.max(d.open, d.close));
|
|
38
|
+
const bodyBottom = toY(Math.min(d.open, d.close));
|
|
39
|
+
this.renderer.rect(cx - bodyWidth / 2, bodyTop, bodyWidth, Math.max(1, bodyBottom - bodyTop), color, null, {
|
|
40
|
+
tooltip: `${d.label}: O ${d.open} H ${d.high} L ${d.low} C ${d.close}`,
|
|
41
|
+
});
|
|
42
|
+
if (i % Math.ceil(data.length / 10 || 1) === 0) {
|
|
43
|
+
this.renderer.text(d.label, cx, y + height + 20, { textAnchor, fontSize: '10px' });
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
markers.forEach((m) => {
|
|
48
|
+
const idx = data.findIndex(d => d.label === m.label);
|
|
49
|
+
if (idx < 0) return;
|
|
50
|
+
const cx = x + idx * slotWidth + slotWidth / 2;
|
|
51
|
+
this.renderer.circle(cx, y - 8, 4, '#f39c12', { color: '#fff', width: 1 }, { tooltip: m.tooltip ?? m.label });
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { Chart } from '../Chart.js';
|
|
2
|
+
import { ColorPalette } from '../ColorPalette.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* ChordDiagram — entities arranged around a circle, with curved links
|
|
6
|
+
* (chords) showing directed or undirected relationships. Link thickness is
|
|
7
|
+
* proportional to value.
|
|
8
|
+
*
|
|
9
|
+
* Data:
|
|
10
|
+
* {
|
|
11
|
+
* nodes?: Array<{id: string, label?: string, color?: string}>,
|
|
12
|
+
* links: Array<{source: string, target: string, value: number}>
|
|
13
|
+
* }
|
|
14
|
+
*
|
|
15
|
+
* Options:
|
|
16
|
+
* - cx, cy, radius, innerRadius
|
|
17
|
+
* - padAngle: gap between node arcs in radians (default 0.04)
|
|
18
|
+
* - colors
|
|
19
|
+
* - title
|
|
20
|
+
*/
|
|
21
|
+
export class ChordDiagram extends Chart {
|
|
22
|
+
static chartType = 'chord';
|
|
23
|
+
|
|
24
|
+
_render() {
|
|
25
|
+
const data = this.data || {};
|
|
26
|
+
const options = this.options || {};
|
|
27
|
+
const w = this.renderer?.width ?? 800;
|
|
28
|
+
const h = this.renderer?.height ?? 400;
|
|
29
|
+
|
|
30
|
+
const {
|
|
31
|
+
cx = w / 2, cy = h / 2 + 10,
|
|
32
|
+
radius = Math.min(w, h) / 2 - 60,
|
|
33
|
+
innerRadius = radius * 0.92,
|
|
34
|
+
padAngle = 0.04,
|
|
35
|
+
colors,
|
|
36
|
+
title,
|
|
37
|
+
} = options;
|
|
38
|
+
|
|
39
|
+
const links = (data.links || []).filter(l => l.value > 0);
|
|
40
|
+
if (links.length === 0) return;
|
|
41
|
+
|
|
42
|
+
const nodeMap = new Map();
|
|
43
|
+
const ensureNode = (id) => {
|
|
44
|
+
if (!nodeMap.has(id)) nodeMap.set(id, { id, label: id, value: 0, color: null });
|
|
45
|
+
return nodeMap.get(id);
|
|
46
|
+
};
|
|
47
|
+
(data.nodes || []).forEach(n => {
|
|
48
|
+
const node = ensureNode(n.id);
|
|
49
|
+
if (n.label != null) node.label = n.label;
|
|
50
|
+
if (n.color != null) node.color = n.color;
|
|
51
|
+
});
|
|
52
|
+
links.forEach(l => {
|
|
53
|
+
ensureNode(l.source);
|
|
54
|
+
ensureNode(l.target);
|
|
55
|
+
});
|
|
56
|
+
links.forEach(l => {
|
|
57
|
+
nodeMap.get(l.source).value += l.value;
|
|
58
|
+
nodeMap.get(l.target).value += l.value;
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
const nodes = [...nodeMap.values()];
|
|
62
|
+
const total = nodes.reduce((s, n) => s + n.value, 0) || 1;
|
|
63
|
+
const palette = new ColorPalette(colors);
|
|
64
|
+
nodes.forEach((n, i) => { n.color = n.color || palette.colorAt(i); });
|
|
65
|
+
|
|
66
|
+
// Assign angles.
|
|
67
|
+
let currentAngle = -Math.PI / 2;
|
|
68
|
+
nodes.forEach(n => {
|
|
69
|
+
const sweep = (n.value / total) * (Math.PI * 2 - nodes.length * padAngle);
|
|
70
|
+
n.start = currentAngle + padAngle / 2;
|
|
71
|
+
n.end = n.start + sweep;
|
|
72
|
+
n.mid = (n.start + n.end) / 2;
|
|
73
|
+
currentAngle = n.end + padAngle / 2;
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
if (title) {
|
|
77
|
+
this.renderer.text(title, cx, cy - radius - 30, { textAnchor: 'middle', fontSize: '18px', fill: '#333' });
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Draw chords first so they sit under the node rim.
|
|
81
|
+
const maxLink = Math.max(...links.map(l => l.value));
|
|
82
|
+
const maxStroke = radius * 0.08;
|
|
83
|
+
links.forEach(l => {
|
|
84
|
+
const s = nodeMap.get(l.source);
|
|
85
|
+
const t = nodeMap.get(l.target);
|
|
86
|
+
const sx = cx + innerRadius * Math.cos(s.mid);
|
|
87
|
+
const sy = cy + innerRadius * Math.sin(s.mid);
|
|
88
|
+
const tx = cx + innerRadius * Math.cos(t.mid);
|
|
89
|
+
const ty = cy + innerRadius * Math.sin(t.mid);
|
|
90
|
+
const c1x = cx + (innerRadius * 0.2) * Math.cos(s.mid);
|
|
91
|
+
const c1y = cy + (innerRadius * 0.2) * Math.sin(s.mid);
|
|
92
|
+
const c2x = cx + (innerRadius * 0.2) * Math.cos(t.mid);
|
|
93
|
+
const c2y = cy + (innerRadius * 0.2) * Math.sin(t.mid);
|
|
94
|
+
const width = Math.max(1, (l.value / maxLink) * maxStroke);
|
|
95
|
+
this.renderer.path(`M${sx},${sy} C${c1x},${c1y} ${c2x},${c2y} ${tx},${ty}`, 'none', {
|
|
96
|
+
color: s.color, width,
|
|
97
|
+
}, {
|
|
98
|
+
tooltip: `${s.label} ↔ ${t.label}: ${l.value}`,
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
// Draw node arcs.
|
|
103
|
+
nodes.forEach(n => {
|
|
104
|
+
const path = this._arcPath(cx, cy, radius, innerRadius, n.start, n.end);
|
|
105
|
+
this.renderer.path(path, n.color, { color: '#fff', width: 1 }, {
|
|
106
|
+
tooltip: `${n.label}: ${n.value}`,
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
// Label outside the circle.
|
|
110
|
+
const lx = cx + (radius + 16) * Math.cos(n.mid);
|
|
111
|
+
const ly = cy + (radius + 16) * Math.sin(n.mid);
|
|
112
|
+
const deg = ((n.mid * 180 / Math.PI) + 90) % 360;
|
|
113
|
+
const rotate = deg > 90 && deg < 270 ? deg + 180 : deg;
|
|
114
|
+
this.renderer.text(n.label, lx, ly, {
|
|
115
|
+
textAnchor: 'middle', fontSize: '10px', fill: '#333',
|
|
116
|
+
transform: `rotate(${rotate - 90},${lx},${ly})`,
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
_arcPath(cx, cy, rOuter, rInner, a0, a1) {
|
|
122
|
+
const largeArc = (a1 - a0) > Math.PI ? 1 : 0;
|
|
123
|
+
const o0 = { x: cx + rOuter * Math.cos(a0), y: cy + rOuter * Math.sin(a0) };
|
|
124
|
+
const o1 = { x: cx + rOuter * Math.cos(a1), y: cy + rOuter * Math.sin(a1) };
|
|
125
|
+
const i0 = { x: cx + rInner * Math.cos(a1), y: cy + rInner * Math.sin(a1) };
|
|
126
|
+
const i1 = { x: cx + rInner * Math.cos(a0), y: cy + rInner * Math.sin(a0) };
|
|
127
|
+
return `M${o0.x},${o0.y} A${rOuter},${rOuter} 0 ${largeArc} 1 ${o1.x},${o1.y} `
|
|
128
|
+
+ `L${i0.x},${i0.y} A${rInner},${rInner} 0 ${largeArc} 0 ${i1.x},${i1.y} Z`;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { Chart } from '../Chart.js';
|
|
2
|
+
import { ChartBox, ChartLabels } from '../ChartBox.js';
|
|
3
|
+
import { ColorPalette } from '../ColorPalette.js';
|
|
4
|
+
import { Statistics } from '../Statistics.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* DensityChart — overlaid distribution curves, one Gaussian-KDE curve per
|
|
8
|
+
* group, sharing one value-axis so shapes are visually comparable. Same
|
|
9
|
+
* top-level data shape as BoxPlotChart (a caller can hand the identical
|
|
10
|
+
* dataset to either) and the same multi-series fill+topline+legend rendering
|
|
11
|
+
* pattern as AreaChart, just with the curve computed from a raw sample
|
|
12
|
+
* instead of literal category/value points. Y is relative density (curve
|
|
13
|
+
* shape only) — no meaningful absolute-number axis, so no numeric y-tick
|
|
14
|
+
* labels.
|
|
15
|
+
*/
|
|
16
|
+
export class DensityChart extends Chart {
|
|
17
|
+
static chartType = 'density';
|
|
18
|
+
|
|
19
|
+
_render() {
|
|
20
|
+
const data = this.data;
|
|
21
|
+
const options = this.options;
|
|
22
|
+
const box = ChartBox.fromRenderer(this.renderer);
|
|
23
|
+
const {
|
|
24
|
+
x = box.x, y = box.y, width = box.width, height = box.height,
|
|
25
|
+
colors, title, xAxisLabel, legend: showLegend = true,
|
|
26
|
+
} = options;
|
|
27
|
+
const plotBox = { x, y, width, height };
|
|
28
|
+
const palette = new ColorPalette(colors);
|
|
29
|
+
|
|
30
|
+
// One shared x-domain (pooled bandwidth) so every group's curve
|
|
31
|
+
// tapers consistently and aligns on the same axis — otherwise a
|
|
32
|
+
// narrow group would get a different padding amount than a broad
|
|
33
|
+
// one, purely as an artifact of computing its own domain alone.
|
|
34
|
+
const allValues = data.flatMap(d => d.values);
|
|
35
|
+
const dataMin = Math.min(...allValues), dataMax = Math.max(...allValues);
|
|
36
|
+
const pooledStdev = Statistics.stdev(allValues);
|
|
37
|
+
const sharedBandwidth = pooledStdev > 0
|
|
38
|
+
? 1.06 * pooledStdev * Math.pow(Math.max(allValues.length, 1), -1 / 5)
|
|
39
|
+
: (dataMax - dataMin) * 0.1 || 1;
|
|
40
|
+
const domainMin = dataMin - 3 * sharedBandwidth;
|
|
41
|
+
const domainMax = dataMax + 3 * sharedBandwidth;
|
|
42
|
+
|
|
43
|
+
// Each curve still uses its OWN group's Silverman bandwidth (a
|
|
44
|
+
// group with fewer/noisier points is smoothed differently than one
|
|
45
|
+
// with many tight points) — only the x-domain/padding is shared.
|
|
46
|
+
const curves = data.map(d => Statistics.kernelDensityEstimate(d.values, { min: domainMin, max: domainMax }));
|
|
47
|
+
const maxDensity = Math.max(...curves.flat().map(p => p.density)) || 1;
|
|
48
|
+
const toX = (v) => x + ((v - domainMin) / (domainMax - domainMin || 1)) * width;
|
|
49
|
+
const toY = (d) => y + height - (d / maxDensity) * height;
|
|
50
|
+
|
|
51
|
+
new ChartLabels({ title, xAxisLabel }).draw(this.renderer, plotBox);
|
|
52
|
+
this.renderer.path(`M${x},${y} L${x},${y + height} L${x + width},${y + height}`, 'none', { color: 'black', width: 1 });
|
|
53
|
+
|
|
54
|
+
data.forEach((d, i) => {
|
|
55
|
+
const color = palette.colorAt(i);
|
|
56
|
+
const topPts = curves[i].map(p => ({ px: toX(p.x), py: toY(p.density) }));
|
|
57
|
+
const topPath = 'M' + topPts.map(p => `${p.px},${p.py}`).join(' L');
|
|
58
|
+
const areaPath = topPath + ` L${x + width},${y + height} L${x},${y + height} Z`;
|
|
59
|
+
const { r, g, b } = ColorPalette.hexToRgb(color);
|
|
60
|
+
this.renderer.path(areaPath, `rgba(${r},${g},${b},0.25)`, null, { tooltip: d.label });
|
|
61
|
+
this.renderer.path(topPath, 'none', { color, width: 2 });
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
if (showLegend) {
|
|
65
|
+
data.forEach((d, i) => {
|
|
66
|
+
const legendX = x + width + 20;
|
|
67
|
+
const legendY = y + i * 20;
|
|
68
|
+
this.renderer.rect(legendX, legendY, 12, 12, palette.colorAt(i), null);
|
|
69
|
+
this.renderer.text(d.label, legendX + 20, legendY + 6, { fontSize: '12px', fill: '#333' });
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { GaugeChart } from './GaugeChart.js';
|
|
2
|
+
import { ArcTrack } from '../gauges/ArcTrack.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* DialGauge — an arc filled to the value, with a needle pointing at it.
|
|
6
|
+
*
|
|
7
|
+
* Data: a value, or several (`[{ value, label?, color? }]`, e.g. actual and
|
|
8
|
+
* budget): a needle each, the first also filling the arc and labelled in
|
|
9
|
+
* the middle, and a legend of them all under the title.
|
|
10
|
+
* Options: cx, cy, r (100, 80, 60), thickness (12), startAngle and sweep in
|
|
11
|
+
* degrees (135 and 270: bottom-left round to bottom-right), needleColors,
|
|
12
|
+
* and every GaugeChart option (min, max, bands, target, ticks, segments, ...).
|
|
13
|
+
*/
|
|
14
|
+
export class DialGauge extends GaugeChart {
|
|
15
|
+
static chartType = 'dialGauge';
|
|
16
|
+
static LAYOUT = { cx: 100, cy: 80, r: 60, thickness: 12, startAngle: 135, sweep: 270 };
|
|
17
|
+
static NEEDLE_COLORS = ['#2f3542', '#ff4757', '#1e90ff', '#ffa502'];
|
|
18
|
+
|
|
19
|
+
track() { return new ArcTrack(this.layout); }
|
|
20
|
+
|
|
21
|
+
/** One per value, the first the main one: {value, label, color}. */
|
|
22
|
+
get needles() {
|
|
23
|
+
const { needleColors = DialGauge.NEEDLE_COLORS } = this.options;
|
|
24
|
+
const values = this.gaugeValue.values.length ? this.gaugeValue.values : [{ value: this.gaugeValue.value }];
|
|
25
|
+
return values.map((v, i) => ({ ...v, value: this.scale.clamp(v.value), color: v.color ?? needleColors[i % needleColors.length] }));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
_render() {
|
|
29
|
+
const { title } = this.options;
|
|
30
|
+
const track = this.track();
|
|
31
|
+
const { cx, cy, r } = track;
|
|
32
|
+
|
|
33
|
+
this.drawBackground(track, { cap: 'round' });
|
|
34
|
+
this.drawValue(track, { cap: 'round' });
|
|
35
|
+
this.drawTarget(track);
|
|
36
|
+
this.drawTicks(track);
|
|
37
|
+
const needles = this.needles;
|
|
38
|
+
// The main needle last, so it is on top.
|
|
39
|
+
for (const needle of [...needles].reverse()) this.drawNeedle(track, needle);
|
|
40
|
+
this.renderer.circle(cx, cy, 5, needles[0].color);
|
|
41
|
+
|
|
42
|
+
this._renderTitle(title, cx, cy + r + 25, { textAnchor: 'middle', fill: '#747d8c', textTransform: 'uppercase' });
|
|
43
|
+
this._renderValueLabel(cx, cy + r - 15, { fontSize: '18px', fill: '#2f3542', fontWeight: 'bold' });
|
|
44
|
+
if (needles.length > 1) this.drawLegend(needles, cx, cy + r + (title ? 42 : 25));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** A needle from the centre to just inside the arc. */
|
|
48
|
+
drawNeedle(track, { value, color }) {
|
|
49
|
+
const tip = track.point(this.scale.fraction(value), -8);
|
|
50
|
+
this.renderer.path(`M${track.cx},${track.cy} L${tip.x},${tip.y}`, 'none', { color, width: 3, cap: 'round' });
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** Each needle's label and value on one line, centred. */
|
|
54
|
+
drawLegend(needles, cx, y) {
|
|
55
|
+
const text = needles.map((n, i) => `${n.label ?? `#${i + 1}`} ${this.scale.label(n.value)}`);
|
|
56
|
+
const font = { fontSize: '11px' };
|
|
57
|
+
const width = (t) => (this.renderer.measureText?.(t, font) ?? t.length * 6) + 22;
|
|
58
|
+
let x = cx - text.reduce((sum, t) => sum + width(t), 0) / 2;
|
|
59
|
+
needles.forEach((needle, i) => {
|
|
60
|
+
this.renderer.circle(x + 4, y, 4, needle.color);
|
|
61
|
+
this.renderer.text(text[i], x + 12, y, { ...font, textAnchor: 'start', verticalAlign: 'middle', fill: '#2f3542' });
|
|
62
|
+
x += width(text[i]);
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { PieChart } from './PieChart.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* DonutChart — convenience subclass that forces a default inner radius.
|
|
5
|
+
*
|
|
6
|
+
* `pieChart` already supports `innerRadiusRatio`; this class exposes the same
|
|
7
|
+
* chart as a first-class catalog type with a sensible default hole size.
|
|
8
|
+
*/
|
|
9
|
+
export class DonutChart extends PieChart {
|
|
10
|
+
static chartType = 'donut';
|
|
11
|
+
|
|
12
|
+
constructor(renderer, data, options = {}) {
|
|
13
|
+
super(renderer, data, { innerRadiusRatio: 0.5, ...options });
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Chart } from '../Chart.js';
|
|
2
|
+
import { ChartBox, ChartLabels } from '../ChartBox.js';
|
|
3
|
+
import { ColorPalette } from '../ColorPalette.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* FunnelChart — one horizontal trapezoid band per stage, width proportional to
|
|
7
|
+
* `value` relative to the largest stage. Each stage's bottom edge width comes
|
|
8
|
+
* from the next stage's value, so the taper between adjacent bands is continuous.
|
|
9
|
+
*/
|
|
10
|
+
export class FunnelChart extends Chart {
|
|
11
|
+
static chartType = 'funnel';
|
|
12
|
+
|
|
13
|
+
_render() {
|
|
14
|
+
const data = this.data;
|
|
15
|
+
const options = this.options;
|
|
16
|
+
const box = ChartBox.fromRenderer(this.renderer);
|
|
17
|
+
const {
|
|
18
|
+
x = box.x, y = box.y, width = box.width, height = box.height,
|
|
19
|
+
colors, title,
|
|
20
|
+
} = options;
|
|
21
|
+
const plotBox = { x, y, width, height };
|
|
22
|
+
const palette = new ColorPalette(colors || ['#5470c6', '#6690d6', '#79aae4', '#8cc4f0', '#a0dcf6', '#b8eefa', '#d0f5fc']);
|
|
23
|
+
const maxValue = Math.max(...data.map(d => d.value)) || 1;
|
|
24
|
+
const stageHeight = height / data.length;
|
|
25
|
+
const textAnchor = this.renderer.centerTextAnchor;
|
|
26
|
+
|
|
27
|
+
new ChartLabels({ title }).draw(this.renderer, plotBox);
|
|
28
|
+
|
|
29
|
+
data.forEach((d, i) => {
|
|
30
|
+
const topWidth = (d.value / maxValue) * width;
|
|
31
|
+
const nextValue = data[i + 1]?.value ?? d.value;
|
|
32
|
+
const bottomWidth = (nextValue / maxValue) * width;
|
|
33
|
+
const top = y + i * stageHeight;
|
|
34
|
+
const bottom = top + stageHeight;
|
|
35
|
+
const topLeft = x + (width - topWidth) / 2;
|
|
36
|
+
const topRight = topLeft + topWidth;
|
|
37
|
+
const bottomLeft = x + (width - bottomWidth) / 2;
|
|
38
|
+
const bottomRight = bottomLeft + bottomWidth;
|
|
39
|
+
|
|
40
|
+
const path = `M${topLeft},${top} L${topRight},${top} L${bottomRight},${bottom} L${bottomLeft},${bottom} Z`;
|
|
41
|
+
this.renderer.path(path, palette.colorAt(i), { color: '#fff', width: 1 }, { tooltip: `${d.label}: ${d.value}` });
|
|
42
|
+
this.renderer.text(`${d.label} (${d.value})`, x + width / 2, top + stageHeight / 2, {
|
|
43
|
+
textAnchor, verticalAlign: 'middle', fontSize: '12px', fill: '#fff', fontWeight: 'bold',
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|