@gramlot/gramlot 0.3.27 → 0.3.31
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/assets/icons/chart.svg +1 -0
- package/dist/components/audio/__init__.py +13 -0
- package/dist/components/audio/assets/collection.js +3 -0
- package/dist/components/audio/assets/index.js +3 -0
- package/dist/components/audio/commands.json +7 -0
- package/dist/components/audio/grammar.json +335 -0
- package/dist/components/charts/__init__.py +13 -0
- package/dist/components/charts/assets/collection.js +47 -0
- package/dist/components/charts/assets/files/55ea01207028f76d844678511f29fc800f8a1e67a8a0fe80470128677847ad32-echarts-gl.txt +29 -0
- package/dist/components/charts/assets/files/63727832aaf62004a2b249c933e327f3c90caf49e41a72f4bf436edf632cbda8-vega.txt +27 -0
- package/dist/components/charts/assets/files/8c45d9eaf50c2f72dd9c7ab9ef440788ba58a3538484b5c51c1f17d5128752e7-plotly.txt +21 -0
- package/dist/components/charts/assets/files/8f989229699b4fe2f1a0432d0e9edc338a8a911e250e2d1b01ecd770a5f5b1bd-uplot.txt +21 -0
- package/dist/components/charts/assets/files/c8fa058cba98f7f288b5d8fa4116f441d6dacb25b96da859e518c973fff41d0c-claygl.txt +23 -0
- package/dist/components/charts/assets/index.js +3 -0
- package/dist/components/charts/assets/modules/chunk-2CCTLZE7.js +76 -0
- package/dist/components/charts/assets/modules/chunk-RMRBEYTI.js +1 -0
- package/dist/components/charts/assets/modules/echarts-gl-CXVTZA6G.js +4409 -0
- package/dist/components/charts/assets/modules/plotly.min-4LB7HE7P.js +3596 -0
- package/dist/components/charts/assets/modules/uPlot.esm-5JJNHHRF.js +3 -0
- package/dist/components/charts/assets/modules/uPlot.min-N3E3FA74.js +1 -0
- package/dist/components/charts/assets/modules/vega.module-2QCOVQ3A.js +13 -0
- package/dist/components/charts/commands.json +7 -0
- package/dist/components/charts/grammar.json +1113 -0
- package/dist/components/chat/__init__.py +1 -1
- package/dist/components/chat/assets/collection.js +3 -3
- package/dist/components/chat/assets/index.js +1 -1
- package/dist/components/drawing/__init__.py +15 -0
- package/dist/components/drawing/assets/collection.js +28 -0
- package/dist/components/drawing/assets/index.js +3 -0
- package/dist/components/drawing/commands.json +7 -0
- package/dist/components/drawing/grammar.json +110 -0
- package/dist/components/editors/__init__.py +2 -2
- package/dist/components/editors/assets/collection.js +18 -18
- package/dist/components/editors/assets/index.js +1 -1
- package/dist/components/editors/assets/modules/{prose-mirror-engine-GMZPJPNN.js → prose-mirror-engine-DQEAEIMV.js} +2 -2
- package/dist/components/editors/grammar.json +150 -0
- package/dist/components/grid/__init__.py +2 -2
- package/dist/components/grid/assets/collection.js +71 -34
- package/dist/components/grid/assets/files/0a1df3a083d0c010560aa342e87959c8c1070e6fd54545741f083f22d0c8b551-fflate.txt +21 -0
- package/dist/components/grid/assets/files/8cf9b31947daf7adb4a7a00a037459e58241af050cd0a603bfcf1756e533f75e-write-excel-file.txt +21 -0
- package/dist/components/grid/assets/index.js +1 -1
- package/dist/components/grid/assets/modules/browser-LVJHKBBV.js +19 -0
- package/dist/components/grid/assets/modules/chunk-RMRBEYTI.js +1 -0
- package/dist/components/grid/commands.json +42 -1
- package/dist/components/grid/grammar.json +650 -10
- package/dist/components/grouplets/__init__.py +1 -1
- package/dist/components/grouplets/assets/collection.js +3 -3
- package/dist/components/grouplets/assets/index.js +1 -1
- package/dist/components/inputs/__init__.py +3 -2
- package/dist/components/inputs/assets/collection.js +38 -23
- package/dist/components/inputs/assets/index.js +1 -1
- package/dist/components/inputs/grammar.json +1533 -321
- package/dist/components/layout/__init__.py +1 -1
- package/dist/components/layout/assets/collection.js +27 -23
- package/dist/components/layout/assets/index.js +1 -1
- package/dist/components/layout/grammar.json +85 -0
- package/dist/components/selection_trial/__init__.py +1 -1
- package/dist/components/selection_trial/assets/collection.js +3 -3
- package/dist/components/selection_trial/assets/index.js +1 -1
- package/dist/components/tree/__init__.py +1 -1
- package/dist/components/tree/assets/collection.js +11 -11
- package/dist/components/tree/assets/index.js +1 -1
- package/dist/components/tree/grammar.json +126 -0
- package/dist/components/typst/__init__.py +1 -1
- package/dist/components/typst/assets/collection.js +2 -2
- package/dist/components/typst/assets/index.js +1 -1
- package/dist/components/uploads/__init__.py +1 -1
- package/dist/components/uploads/assets/collection.js +8 -8
- package/dist/components/uploads/assets/index.js +1 -1
- package/dist/components/vizabi/__init__.py +13 -0
- package/dist/components/vizabi/assets/collection.js +22 -0
- package/dist/components/vizabi/assets/index.js +3 -0
- package/dist/components/vizabi/commands.json +7 -0
- package/dist/components/vizabi/grammar.json +128 -0
- package/dist/gramlot.js +944 -193
- package/dist/gramlot.min.js +85 -53
- package/dist/standard-collections.js +2 -0
- package/package.json +13 -4
- package/src/binding/grid-struct.js +5 -2
- package/src/binding/runtime.js +12 -1
- package/src/bootstrap.js +1 -1
- package/src/builder/gramlot-builder.d.ts +15 -2
- package/src/builder/gramlot-builder.js +116 -8
- package/src/builder/source.js +42 -1
- package/src/components/audio-analysis-session.js +65 -0
- package/src/components/audio.js +44 -0
- package/src/components/bases.js +6 -4
- package/src/components/border-container.js +6 -3
- package/src/components/buttons.js +47 -3
- package/src/components/chart-bar3d-options.js +30 -0
- package/src/components/chart-controls.js +83 -0
- package/src/components/chart-data-view.js +52 -0
- package/src/components/chart-data.js +42 -0
- package/src/components/chart-domains.js +46 -0
- package/src/components/chart-engines/echarts-options.js +50 -0
- package/src/components/chart-engines/echarts.js +82 -0
- package/src/components/chart-engines/index.js +22 -0
- package/src/components/chart-engines/plotly-map.js +34 -0
- package/src/components/chart-engines/plotly-spatial.js +35 -0
- package/src/components/chart-engines/plotly.js +138 -0
- package/src/components/chart-engines/uplot.js +57 -0
- package/src/components/chart-engines/vega.js +101 -0
- package/src/components/chart-fields.js +110 -0
- package/src/components/chart-geographic-options.js +47 -0
- package/src/components/chart-geojson.js +60 -0
- package/src/components/chart-geometry.js +11 -0
- package/src/components/chart-map-anchors.js +24 -0
- package/src/components/chart-map-bar3d-options.js +41 -0
- package/src/components/chart-map-data.js +25 -0
- package/src/components/chart-map-labels.js +8 -0
- package/src/components/chart-map-options.js +20 -0
- package/src/components/chart-pane.js +91 -0
- package/src/components/chart-renderer.js +58 -0
- package/src/components/chart-sample-view.js +32 -0
- package/src/components/chart-spatial-options.js +40 -0
- package/src/components/chart-time.js +84 -0
- package/src/components/chart-timeline.js +70 -0
- package/src/components/chart-types/area.js +2 -0
- package/src/components/chart-types/bar.js +2 -0
- package/src/components/chart-types/bar3D.js +2 -0
- package/src/components/chart-types/donut.js +2 -0
- package/src/components/chart-types/horizontalBar.js +2 -0
- package/src/components/chart-types/index.js +26 -0
- package/src/components/chart-types/line.js +2 -0
- package/src/components/chart-types/line3D.js +2 -0
- package/src/components/chart-types/lines3D.js +2 -0
- package/src/components/chart-types/map.js +2 -0
- package/src/components/chart-types/map3D.js +2 -0
- package/src/components/chart-types/mapBar3D.js +2 -0
- package/src/components/chart-types/pie.js +2 -0
- package/src/components/chart-types/polygons3D.js +2 -0
- package/src/components/chart-types/scatter.js +2 -0
- package/src/components/chart-types/scatter3D.js +2 -0
- package/src/components/chart-types/stackedArea.js +2 -0
- package/src/components/chart-types/stackedBar.js +2 -0
- package/src/components/chart-types/surface.js +2 -0
- package/src/components/charts.js +152 -0
- package/src/components/check-box-text-editor.js +88 -0
- package/src/components/check-box-text.js +193 -0
- package/src/components/check-box-tree.js +62 -0
- package/src/components/choice-editor.js +7 -5
- package/src/components/choice-field-styles.js +14 -0
- package/src/components/choices.js +5 -0
- package/src/components/drawing.js +199 -0
- package/src/components/grid-check-sets.js +98 -0
- package/src/components/grid-column-filters.js +198 -0
- package/src/components/grid-footer.js +120 -0
- package/src/components/grid-formulas.js +403 -0
- package/src/components/grid-grammar.json +131 -2
- package/src/components/grid-header-interaction.js +3 -1
- package/src/components/grid-rows.js +2 -2
- package/src/components/grid-search-box.js +38 -22
- package/src/components/grid-search-styles.js +13 -14
- package/src/components/grid-search.js +8 -1
- package/src/components/grid-selection.js +118 -0
- package/src/components/grid-structure.js +36 -5
- package/src/components/grid-styles.js +37 -1
- package/src/components/grid-tools.js +229 -0
- package/src/components/grid.js +223 -15
- package/src/components/image-uploader.js +2 -2
- package/src/components/inputs.js +19 -10
- package/src/components/labelbox.js +5 -1
- package/src/components/licenses/claygl.txt +23 -0
- package/src/components/licenses/echarts-gl.txt +29 -0
- package/src/components/licenses/fflate.txt +21 -0
- package/src/components/licenses/plotly.txt +21 -0
- package/src/components/licenses/uplot.txt +21 -0
- package/src/components/licenses/vega.txt +27 -0
- package/src/components/licenses/write-excel-file.txt +21 -0
- package/src/components/menus.js +19 -11
- package/src/components/toolbar-overflow.js +12 -8
- package/src/components/tree.js +30 -8
- package/src/components/typed-editor.js +14 -3
- package/src/components/vizabi-session.js +66 -0
- package/src/components/vizabi.js +66 -0
- package/src/components/window-surface.js +20 -9
- package/src/components/windows.js +1 -1
- package/src/editing-session.d.ts +2 -0
- package/src/editing-session.js +35 -3
- package/src/gramlot.d.ts +1 -0
- package/src/gramlot.js +2 -0
- package/src/handlers/device-handler.js +32 -32
- package/src/handlers/source-handler.d.ts +2 -2
- package/src/ide-documents.js +19 -3
- package/src/ide-runtime.d.ts +1 -0
- package/src/ide-runtime.js +45 -31
- package/src/index.d.ts +1 -0
- package/src/renderer/drag-drop.js +1 -0
- package/src/renderer/gramlot-renderer.d.ts +2 -0
- package/src/renderer/gramlot-renderer.js +5 -4
- package/src/server/assets.d.ts +3 -0
- package/src/server/assets.js +9 -0
- package/src/server/gramlot-server.d.ts +1 -1
- package/src/server/gramlot-server.js +2 -1
- package/src/server/index.d.ts +1 -1
- package/src/server/index.js +1 -1
- package/src/server/visual-editor.js +17 -17
- package/src/stores/bag-collection-store.js +14 -5
- package/src/stores/bag-collection-view.js +80 -18
- package/src/stores/collection-filter.js +2 -1
- package/src/stores/column-filter.js +49 -0
- package/src/stores/id-set.js +10 -0
- package/src/view/controls.js +8 -0
- package/src/view/html.js +10 -1
- package/src/view/label-menu.js +61 -0
- package/src/view/labelbox.js +15 -2
- package/themes/gramlot-base/theme.css +6 -0
- package/tools/gramlot-tools-inspector.js +169 -505
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Shared numeric map presentation; zero is a value, missing is never zero. */
|
|
2
|
+
export function chartMapLabel(name,value,mode='value') {
|
|
3
|
+
if(!['none','name','value','nameValue'].includes(mode))throw new TypeError('Choose a supported map label mode');
|
|
4
|
+
if(mode==='none'||!Number.isFinite(value))return '';
|
|
5
|
+
const number=value.toLocaleString('en-GB',{notation:'compact',maximumFractionDigits:1});
|
|
6
|
+
return mode==='name'?name:mode==='value'?number:`${name}\n${number}`;
|
|
7
|
+
}
|
|
8
|
+
export const chartMapColors=['#77bce4','#307eb9','#083e80'];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {chartMapLabel,chartMapColors} from './chart-map-labels.js';
|
|
2
|
+
import {chartMapData} from './chart-map-data.js';
|
|
3
|
+
|
|
4
|
+
/** A choropleth consumes explicit store measures; business ratios stay with their data owner. */
|
|
5
|
+
export function chartMapOptions(view,nameField,valueField,labelField,mapName,geoJSON,caption,domains,labelMode='value') {
|
|
6
|
+
const {data,labels,...extent}=chartMapData(view,nameField,valueField,labelField,geoJSON);
|
|
7
|
+
const {min,max,signed}=domains?domains.map:extent;
|
|
8
|
+
const format=value=>Number(value).toLocaleString('en-GB',{maximumFractionDigits:2});
|
|
9
|
+
const title=caption || valueField;
|
|
10
|
+
return {backgroundColor:'#fff',title:{text:title,left:'center',top:8,textStyle:{color:'#27344b',fontSize:14}},
|
|
11
|
+
tooltip:{trigger:'item',renderMode:'richText',formatter:params=>`${labels.get(params.name) || params.name}\n${title}: ${Number.isFinite(params.value)?format(params.value):'No data'}`},
|
|
12
|
+
visualMap:{type:'continuous',min,max,seriesIndex:0,dimension:0,calculable:true,orient:'horizontal',left:'center',bottom:12,
|
|
13
|
+
itemWidth:12,itemHeight:180,precision:2,formatter:format,textStyle:{color:'#27344b'},
|
|
14
|
+
inRange:{color:signed?['#b73548','#f7f7f7','#2166ac']:chartMapColors},outOfRange:{color:'#e2e5e9'}},
|
|
15
|
+
series:[{name:title,type:'map',map:mapName,preserveAspect:'contain',aspectScale:1,roam:true,top:42,bottom:70,left:20,right:20,
|
|
16
|
+
itemStyle:{areaColor:'#e2e5e9',borderColor:'#fff',borderWidth:0.45},
|
|
17
|
+
label:{show:true,color:'#182c46',fontSize:11,textBorderColor:'#fff',textBorderWidth:3,
|
|
18
|
+
formatter:params=>chartMapLabel(labels.get(params.name) || params.name,params.value,labelMode)},labelLayout:{hideOverlap:true},
|
|
19
|
+
emphasis:{label:{show:true},itemStyle:{borderColor:'#1b273d',borderWidth:2}},data}]};
|
|
20
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import {Bag,fromTytx,toTytx} from '@gramlot/gramlot';
|
|
2
|
+
import {defineComponent} from './registry.js';
|
|
3
|
+
import {Container} from './container.js';
|
|
4
|
+
import {randomId} from '../random-id.js';
|
|
5
|
+
import {chartTimeLogic} from './chart-timeline.js';
|
|
6
|
+
import {chartControls} from './chart-controls.js';
|
|
7
|
+
|
|
8
|
+
/** One shared Source composition for Python and JavaScript callers. */
|
|
9
|
+
export const ChartPane = defineComponent({
|
|
10
|
+
name:'chartPane',tag:'gramlot-chart-pane',base:Container,sourceContext:true,subTags:'*',
|
|
11
|
+
parameters:{configDefaults:{dtype:'X',nullable:true},storepath:{dtype:'T'},configpath:{dtype:'T'},rowMode:{dtype:'T',default:'attributes'},gridId:{dtype:'T',nullable:true}},
|
|
12
|
+
implementation:Base => class extends Base {
|
|
13
|
+
#context; #built=false;
|
|
14
|
+
constructor() {
|
|
15
|
+
super();
|
|
16
|
+
const style=this.ownerDocument.createElement('style');
|
|
17
|
+
style.textContent=':host{height:100%;min-height:0}.control-box{height:100%;min-height:0}';
|
|
18
|
+
this.shadowRoot.append(style);
|
|
19
|
+
}
|
|
20
|
+
setSourceContext(context) { this.#context=context; }
|
|
21
|
+
connectedCallback() {
|
|
22
|
+
if(this.#built)return;
|
|
23
|
+
const node=this.#context.sourceNode;
|
|
24
|
+
if(node.value !== null && node.value.getNode('frame'))return;
|
|
25
|
+
const storepath=node.absDatapath(this.parameters.storepath);
|
|
26
|
+
const configpath=node.absDatapath(this.parameters.configpath);
|
|
27
|
+
let configuration=node.getRelativeData(configpath);
|
|
28
|
+
if (configuration == null) {
|
|
29
|
+
configuration=new Bag(); node.setRelativeData(configpath,configuration);
|
|
30
|
+
}
|
|
31
|
+
const initial=this.parameters.configDefaults;
|
|
32
|
+
if (initial != null) {
|
|
33
|
+
if (!(initial instanceof Bag)) throw new TypeError('configDefaults requires a Bag');
|
|
34
|
+
const values=fromTytx(toTytx(initial));
|
|
35
|
+
for (const entry of values.getNodes()) if (!configuration.getNode(entry.label))
|
|
36
|
+
configuration.setItem(entry.label,entry.getValue());
|
|
37
|
+
}
|
|
38
|
+
if(!(configuration instanceof Bag))throw new TypeError('chartPane requires a configuration Bag');
|
|
39
|
+
const defaults={mapLabelMode:'value',mapBarScale:'zero',selectedTerritory:'',timeField:'',timeEmpty:'previous',timeSnapshotLabel:'',timeStep:'auto',timeUnit:'month',timeHasClock:false,timeIndex:0,timeMax:0,timeAtEnd:true,timeValue:null,timeLabel:'',timePlaying:false,timeSpeed:0.8,engine:'echarts',chartType:'bar',captionField:'',secondCaptionField:'',geometryField:'',mapValueField:'',mapLabelField:'',geoJSON:null,drawer:'close'};
|
|
40
|
+
for(const [key,value] of Object.entries(defaults))if(!configuration.getNode(key))configuration.setItem(key,value);
|
|
41
|
+
if(!configuration.getNode('seriesOptions'))configuration.setItem('seriesOptions',new Bag());
|
|
42
|
+
if(!(configuration.getItem('seriesOptions') instanceof Bag))throw new TypeError('seriesOptions must be a Bag');
|
|
43
|
+
const fragment=new node.builder.source.constructor(null,node.builder);
|
|
44
|
+
const frame=node.builder.wrapSource(fragment).framePane({node_label:'frame',height:'100%'});
|
|
45
|
+
frame.dataFormula({result_path:`${configpath}.valueFields`,formula:"options.getNodes().filter(n => n.getValue().getItem('selected')).map(n => n.label).join(',')",options:`^${configpath}.seriesOptions`,_onBuilt:true});
|
|
46
|
+
const toolbar=frame.top.contentPane({display:'flex',justify_content:'flex-end',align_items:'center',padding:'2px 6px'});
|
|
47
|
+
const path=JSON.stringify(`${configpath}.drawer`);
|
|
48
|
+
toolbar.button({icon:'⚙',aria_label:'Chart settings',title:'Chart settings',action:`this.SET(${path},this.GET(${path}) === 'close' ? true : 'close');`});
|
|
49
|
+
const prefix=node.getAttr('id') ?? `chart-${randomId()}`;
|
|
50
|
+
const layout=frame.center.borderContainer({id:`${prefix}-layout`,height:'100%'});
|
|
51
|
+
const config=layout.contentPane({region:'right',width:'260px',drawer:`^${configpath}.drawer`,
|
|
52
|
+
drawer_style:'display:none',detachable:true,title:'Chart configuration',padding:'8px',
|
|
53
|
+
border_left:'1px solid var(--gramlot-border)',background:'var(--gramlot-surface)',
|
|
54
|
+
overflow:'auto',display:'grid',gap:'4px',align_content:'start',
|
|
55
|
+
style:'font-size:12px;--gramlot-field-height:26px;--gramlot-field-padding:2px 5px;--gramlot-grid-row-height:26px'});
|
|
56
|
+
const attrs={id:`${prefix}-view`,configpath,storepath,rowMode:this.parameters.rowMode};
|
|
57
|
+
for(const key of ['mapLabelMode','mapBarScale','selectedTerritory','timeEmpty','timeField','timeValue','timeStep','engine','mapValueField','mapLabelField','geoJSON','geometryField','chartType','captionField','secondCaptionField','valueFields','seriesOptions'])attrs[key]=`^${configpath}.${key==='timeStep'?'timeUnit':key}`;
|
|
58
|
+
if(this.parameters.gridId)attrs.gridId=this.parameters.gridId;
|
|
59
|
+
layout.contentPane({region:'center',min_width:'0'}).chartView(attrs);
|
|
60
|
+
chartControls(config,{configpath,storepath,rowMode:this.parameters.rowMode,prefix});
|
|
61
|
+
frame.dataFormula({result_path:`${configpath}.timeInterval`,formula:'playing ? speed : 0',playing:`^${configpath}.timePlaying`,speed:`^${configpath}.timeSpeed`,_onBuilt:true});
|
|
62
|
+
frame.dataController({func:chartTimeLogic(node.rootBuilder.binding),configpath,_timing:`^${configpath}.timeInterval`});
|
|
63
|
+
frame.dataFormula({result_path:`${configpath}.timeAtEnd`,formula:'index >= max',index:`^${configpath}.timeIndex`,max:`^${configpath}.timeMax`,_onBuilt:true});
|
|
64
|
+
const timeline=frame.bottom.contentPane({display:`^${configpath}.timeField:={} ? 'flex' : 'none'`,align_items:'center',flex_wrap:'wrap',gap:'10px',padding:'8px 12px',role:'toolbar',aria_label:'Playback controls',
|
|
65
|
+
background:'var(--gramlot-surface-subtle)',border_top:'1px solid var(--gramlot-border)'});
|
|
66
|
+
const get=key=>JSON.stringify(`${configpath}.${key}`);
|
|
67
|
+
const transport=timeline.div({display:'flex',align_items:'center',gap:'2px',flex_shrink:'0'});
|
|
68
|
+
transport.button({icon:'←',aria_label:'Previous period',title:'Previous period',id:`${prefix}-time-previous`,
|
|
69
|
+
disabled:`^${configpath}.timeIndex:={} <= 0`,action:`this.SET(${get('timePlaying')},false);this.SET(${get('timeIndex')},Math.max(0,this.GET(${get('timeIndex')})-1));`});
|
|
70
|
+
transport.button({icon:`^${configpath}.timePlaying:={} ? '⏸︎' : '▶'`,
|
|
71
|
+
aria_label:`^${configpath}.timePlaying:={} ? 'Pause' : 'Play'`,title:`^${configpath}.timePlaying:={} ? 'Pause' : 'Play'`,aria_pressed:`^${configpath}.timePlaying`,id:`${prefix}-time-play`,disabled:`^${configpath}.timeMax:={} === 0`,
|
|
72
|
+
action:`if(!this.GET(${get('timePlaying')}) && this.GET(${get('timeIndex')}) >= this.GET(${get('timeMax')}))this.SET(${get('timeIndex')},0);this.SET(${get('timePlaying')},!this.GET(${get('timePlaying')}));`});
|
|
73
|
+
transport.button({icon:'■',aria_label:'Stop',title:'Stop and return to the beginning',id:`${prefix}-time-stop`,
|
|
74
|
+
disabled:`^${configpath}.timeMax:={} === 0`,action:`this.SET(${get('timePlaying')},false);this.SET(${get('timeIndex')},0);`});
|
|
75
|
+
transport.button({icon:'→',aria_label:'Next period',title:'Next period',id:`${prefix}-time-next`,
|
|
76
|
+
disabled:`^${configpath}.timeAtEnd`,action:`this.SET(${get('timePlaying')},false);this.SET(${get('timeIndex')},Math.min(this.GET(${get('timeMax')}),this.GET(${get('timeIndex')})+1));`});
|
|
77
|
+
const scrubber=timeline.div({flex:'1',min_width:'120px'});
|
|
78
|
+
scrubber.horizontalSlider({width:'100%',id:`${prefix}-time-slider`,aria_label:'Temporal snapshot',value:`^${configpath}.timeIndex`,min:0,max:`^${configpath}.timeMax`,step:1,live:true,flex:'1',
|
|
79
|
+
connect_oninput:`this.SET(${get('timePlaying')},false);`});
|
|
80
|
+
const dates=timeline.div({display:'grid',gap:'2px',white_space:'nowrap',text_align:'right',font_size:'12px',font_variant_numeric:'tabular-nums'});
|
|
81
|
+
dates.span(`^${configpath}.timeLabel`,{id:`${prefix}-time-label`,font_weight:'600'});
|
|
82
|
+
dates.small(`^${configpath}.timeSnapshotLabel`,{id:`${prefix}-snapshot-label`,color:'var(--gramlot-text-secondary)',display:`^${configpath}.timeSnapshotLabel:={} ? '' : 'none'`});
|
|
83
|
+
|
|
84
|
+
const app=node.rootBuilder.binding.gramlot;
|
|
85
|
+
const source=app.src.prepareSource(fragment);
|
|
86
|
+
app.src.renderer.validateCandidate(source);
|
|
87
|
+
this.#built=true;
|
|
88
|
+
node.setValue(source);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
});
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import {Bag} from '@gramlot/gramlot';
|
|
2
|
+
import {chartType} from './chart-types/index.js';
|
|
3
|
+
import {requireChartCapability} from './chart-engines/index.js';
|
|
4
|
+
|
|
5
|
+
/** Engine-independent context. Reading it never rewrites either Data Bag. */
|
|
6
|
+
export function chartContext(view,structure,seriesOptions) {
|
|
7
|
+
if (!(seriesOptions instanceof Bag)) throw new TypeError('seriesOptions requires a Bag');
|
|
8
|
+
const type = chartType(structure.getItem('chartType'));
|
|
9
|
+
const category = structure.getItem('captionField');
|
|
10
|
+
const selection = structure.getItem('valueFields');
|
|
11
|
+
if (selection !== null && typeof selection !== 'string') throw new TypeError('valueFields requires comma-separated codes or null');
|
|
12
|
+
let fields = selection ? selection.split(',') : [];
|
|
13
|
+
if (fields.some(field => !field) || new Set(fields).size !== fields.length) throw new TypeError('valueFields requires distinct nonempty fields');
|
|
14
|
+
if (typeof category !== 'string' || !category) {
|
|
15
|
+
throw new TypeError('Chart requires captionField');
|
|
16
|
+
}
|
|
17
|
+
if (type.measureLimit !== null) fields = fields.slice(0,type.measureLimit);
|
|
18
|
+
const settings = fields.map(field => {
|
|
19
|
+
const options = seriesOptions.getItem(field);
|
|
20
|
+
if (!(options instanceof Bag)) throw new TypeError(`Missing seriesOptions for ${field}`);
|
|
21
|
+
const axis = options.getItem('axis'), color = options.getItem('color');
|
|
22
|
+
if (!['left','right'].includes(axis) || typeof color !== 'string' || !/^#[0-9a-f]{6}$/i.test(color)) {
|
|
23
|
+
throw new TypeError('Series requires left/right axis and a six-digit hex color');
|
|
24
|
+
}
|
|
25
|
+
return {axis,color};
|
|
26
|
+
});
|
|
27
|
+
return {view,category,structure,fields,settings,seriesOptions,type};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** Own an engine instance; adapters own rendering and engine-specific resources. */
|
|
31
|
+
export class ChartRenderer {
|
|
32
|
+
#element; #view; #options; #adapter; #engine; #host; #revision=0;
|
|
33
|
+
constructor(element,view,options={}) { this.#element=element;this.#view=view;this.#options=options; }
|
|
34
|
+
async prepare(engine,type) { await requireChartCapability(engine,type).load(type); }
|
|
35
|
+
invalidate() { this.#revision++; }
|
|
36
|
+
update(structure,seriesOptions) {
|
|
37
|
+
const engine=structure.getItem('engine') ?? 'echarts';
|
|
38
|
+
const context=chartContext(this.#view,structure,seriesOptions);
|
|
39
|
+
context.domains=this.#options.domains ? this.#options.domains(context) : null;
|
|
40
|
+
const Adapter=requireChartCapability(engine,context.type.id);
|
|
41
|
+
const revision=++this.#revision;
|
|
42
|
+
if(engine!==this.#engine) {
|
|
43
|
+
this.#adapter?.dispose();this.#host?.remove();
|
|
44
|
+
this.#host=null;
|
|
45
|
+
if(this.#element) {
|
|
46
|
+
this.#host=this.#element.ownerDocument.createElement('div');
|
|
47
|
+
this.#host.style.cssText='width:100%;height:100%;position:relative';
|
|
48
|
+
this.#element.append(this.#host);
|
|
49
|
+
}
|
|
50
|
+
this.#adapter=new Adapter(this.#host,this.#options);this.#engine=engine;
|
|
51
|
+
}
|
|
52
|
+
const figure=this.#adapter.validate(context);
|
|
53
|
+
return this.#adapter.update(context,figure,()=>revision===this.#revision);
|
|
54
|
+
}
|
|
55
|
+
svg() { return this.#adapter.svg(); }
|
|
56
|
+
resize() { this.#adapter?.resize(); }
|
|
57
|
+
dispose() { this.invalidate();this.#adapter?.dispose();this.#adapter=null;this.#engine=null;this.#host?.remove();this.#host=null; }
|
|
58
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {chartDomains} from './chart-domains.js';
|
|
2
|
+
|
|
3
|
+
/** Numeric snapshot projection; row handles are indices, never Bag nodes. */
|
|
4
|
+
export class ChartSampleView {
|
|
5
|
+
bind(samples, step, start, category, measure) {
|
|
6
|
+
if (!Array.isArray(samples) || samples.some(value => typeof value !== 'number' || !Number.isFinite(value))) {
|
|
7
|
+
throw new TypeError('Sample chart requires an array of finite numbers');
|
|
8
|
+
}
|
|
9
|
+
if (!Number.isFinite(step) || step <= 0 || !Number.isFinite(start)) throw new TypeError('Sample chart requires a positive step and finite start');
|
|
10
|
+
if (typeof category !== 'string' || !category || typeof measure !== 'string' || !measure || measure.includes(',') || category === measure) throw new TypeError('Sample chart requires distinct captionField and one valueFields name');
|
|
11
|
+
this.samples = samples;
|
|
12
|
+
this.step = step; this.start = start; this.category = category; this.measure = measure;
|
|
13
|
+
if (this.rows?.length !== samples.length) this.rows = Array.from(samples.keys());
|
|
14
|
+
}
|
|
15
|
+
domains(context, min, max) {
|
|
16
|
+
if (min == null && max == null) return null;
|
|
17
|
+
if (!Number.isFinite(min) || !Number.isFinite(max) || min >= max) {
|
|
18
|
+
throw new TypeError('Sample bounds require finite sampleMin < sampleMax');
|
|
19
|
+
}
|
|
20
|
+
const domains = chartDomains(this, context);
|
|
21
|
+
domains.dimension.range = [this.start, this.start + Math.max(1, this.samples.length - 1) * this.step];
|
|
22
|
+
domains.axes = {left:[min,max], right:[min,max]};
|
|
23
|
+
domains.z = [min,max];
|
|
24
|
+
return domains;
|
|
25
|
+
}
|
|
26
|
+
getRows() { return this.rows; }
|
|
27
|
+
value(index, field) {
|
|
28
|
+
if (field === this.category) return this.start + index * this.step;
|
|
29
|
+
if (field === this.measure) return this.samples[index];
|
|
30
|
+
throw new TypeError(`Unknown sample field: ${field}`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import {chartData3D} from './chart-data.js';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
/** Cartesian 3D series keep store values and category labels on their actual axes. */
|
|
5
|
+
export function chartSpatialOptions(view,type,first,second,fields,settings,domains) {
|
|
6
|
+
const rows=view.getRows();
|
|
7
|
+
const numeric=field=>rows.every(row=>{
|
|
8
|
+
const value=view.value(row,field);
|
|
9
|
+
return typeof value==='number'&&Number.isFinite(value) || value instanceof Date&&Number.isFinite(value.getTime());
|
|
10
|
+
});
|
|
11
|
+
const axes=[first,second].map((field,i)=>({numeric:domains?domains.dimensions[i].kind!=='category':numeric(field),date:domains?domains.dimensions[i].kind==='time':rows.length>0&&view.value(rows[0],field) instanceof Date}));
|
|
12
|
+
if(['scatter3D','surface'].includes(type)&&axes.some(axis=>!axis.numeric))throw new TypeError('Choose numeric or date fields for both dimensions');
|
|
13
|
+
const datasets=fields.map(field=>chartData3D(view,first,second,field,domains));
|
|
14
|
+
const dimensions=datasets[0]?.dimensions ?? [[],[]];
|
|
15
|
+
const coordinates=dimensions.map((values,axis)=>values.map((value,index)=>axes[axis].numeric?(axes[axis].date?Date.parse(value):Number(value)):index));
|
|
16
|
+
const axisOptions=index=>({type:axes[index].numeric?'value':'category',name:[first,second][index],nameGap:35,
|
|
17
|
+
...(axes[index].numeric?(domains?{min:domains.dimensions[index].range[0],max:domains.dimensions[index].range[1]}:{}):{data:dimensions[index]}),
|
|
18
|
+
...(axes[index].date?{axisLabel:{formatter:value=>new Date(value).toISOString().slice(0,10)}}:{})});
|
|
19
|
+
const series=[];
|
|
20
|
+
datasets.forEach((dataset,index)=>{
|
|
21
|
+
const common={name:fields[index],type,itemStyle:{color:settings[index].color},lineStyle:{color:settings[index].color,width:3}};
|
|
22
|
+
const mapped=dataset.source.map(([x,y,z])=>[coordinates[0][x],coordinates[1][y],z]);
|
|
23
|
+
if(type==='line3D') {
|
|
24
|
+
dimensions[1].forEach((plane,y)=>{
|
|
25
|
+
const data=dataset.source.filter(row=>row[1]===y).map(([x,,z])=>[coordinates[0][x],coordinates[1][y],z]).sort((a,b)=>a[0]-b[0]);
|
|
26
|
+
series.push({...common,id:`${fields[index]}:${y}`,data});
|
|
27
|
+
});
|
|
28
|
+
} else if(type==='surface') {
|
|
29
|
+
const xs=[...coordinates[0]].sort((a,b)=>a-b),ys=[...coordinates[1]].sort((a,b)=>a-b),values=new Map();
|
|
30
|
+
for(const [x,y,z] of mapped){const key=JSON.stringify([x,y]);if(values.has(key))throw new TypeError('Surface has repeated coordinates: prepare unique coordinate pairs upstream');values.set(key,z);}
|
|
31
|
+
if(xs.length<2||ys.length<2)throw new TypeError('A surface needs at least two distinct values on each dimension');
|
|
32
|
+
series.push({...common,id:fields[index],dataShape:[ys.length,xs.length],shading:'lambert',
|
|
33
|
+
itemStyle:{color:settings[index].color,opacity:fields.length>1?0.7:1},
|
|
34
|
+
data:ys.flatMap(y=>xs.map(x=>[x,y,values.get(JSON.stringify([x,y])) ?? NaN]))});
|
|
35
|
+
} else series.push({...common,id:fields[index],symbolSize:9,data:mapped});
|
|
36
|
+
});
|
|
37
|
+
return {backgroundColor:'#fff',legend:{type:'scroll',left:12,right:12,bottom:10,data:fields},
|
|
38
|
+
tooltip:{renderMode:'richText'},xAxis3D:axisOptions(0),yAxis3D:axisOptions(1),zAxis3D:{type:'value',name:'Value',nameGap:40,...(domains?{min:domains.z[0],max:domains.z[1]}:{})},
|
|
39
|
+
grid3D:{top:8,bottom:64,height:null,left:16,right:16,width:null,boxWidth:100,boxDepth:80,viewControl:{projection:'perspective'}},series};
|
|
40
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import {getDateType} from '@genrojs/tytx';
|
|
2
|
+
import {chartDomains} from './chart-domains.js';
|
|
3
|
+
const day=86400000;
|
|
4
|
+
const units={minute:60000,hour:3600000,day,week:7*day};
|
|
5
|
+
const monday=4*day; // 1970-01-05, first Monday after the epoch.
|
|
6
|
+
export function timePeriod(value,step) {
|
|
7
|
+
if(!(value instanceof Date)||!Number.isFinite(value.getTime()))throw new TypeError('Temporal snapshots require Date values');
|
|
8
|
+
if(Object.hasOwn(units,step))return Math.floor((value.getTime()-(step==='week'?monday:0))/units[step]);
|
|
9
|
+
if(step==='month')return value.getUTCFullYear()*12+value.getUTCMonth();
|
|
10
|
+
if(step==='year')return value.getUTCFullYear();
|
|
11
|
+
throw new TypeError('Time step must be minute, hour, day, week, month or year');
|
|
12
|
+
}
|
|
13
|
+
export function timeDate(period,step) {
|
|
14
|
+
if(Object.hasOwn(units,step))return new Date(period*units[step]+(step==='week'?monday:0));
|
|
15
|
+
const date=new Date(0);
|
|
16
|
+
if(step==='month')date.setUTCFullYear(Math.floor(period/12),period-Math.floor(period/12)*12,1);
|
|
17
|
+
else if(step==='year')date.setUTCFullYear(period,0,1);
|
|
18
|
+
else throw new TypeError('Time step must be minute, hour, day, week, month or year');
|
|
19
|
+
return date;
|
|
20
|
+
}
|
|
21
|
+
export function timeExtent(view,field,step) {
|
|
22
|
+
let min=Infinity,max=-Infinity;
|
|
23
|
+
for(const row of view.getRows()) {
|
|
24
|
+
const value=view.value(row,field);
|
|
25
|
+
if(value==null)continue;
|
|
26
|
+
const period=timePeriod(value,step);min=Math.min(min,period);max=Math.max(max,period);
|
|
27
|
+
}
|
|
28
|
+
return min===Infinity?null:{min,max};
|
|
29
|
+
}
|
|
30
|
+
/** Detect available precision using the framework's existing Date classification. */
|
|
31
|
+
export function timeProfile(view,field){
|
|
32
|
+
let min=Infinity,max=-Infinity,hasClock=false;
|
|
33
|
+
for(const row of field?view.getRows():[]){
|
|
34
|
+
const value=view.value(row,field);
|
|
35
|
+
if(value==null)continue;
|
|
36
|
+
timePeriod(value,'day');
|
|
37
|
+
min=Math.min(min,value.getTime());max=Math.max(max,value.getTime());
|
|
38
|
+
hasClock ||= getDateType(value)!=='D';
|
|
39
|
+
}
|
|
40
|
+
const steps=hasClock?['minute','hour','day','week','month','year']:['day','week','month','year'];
|
|
41
|
+
const first=min===Infinity?null:new Date(min),last=min===Infinity?null:new Date(max);
|
|
42
|
+
const suggested=first?steps.find(step=>timePeriod(last,step)-timePeriod(first,step)<=36) ?? 'year':'day';
|
|
43
|
+
return {hasClock,steps,suggested,first,last};
|
|
44
|
+
}
|
|
45
|
+
export function timeLabel(value,step){
|
|
46
|
+
const iso=value.toISOString();
|
|
47
|
+
if(step==='week')return `${iso.slice(0,10)} – ${new Date(value.getTime()+6*day).toISOString().slice(0,10)} UTC`;
|
|
48
|
+
if(step==='hour'||step==='minute')return `${iso.slice(0,16).replace('T',' ')} UTC`;
|
|
49
|
+
return iso.slice(0,step==='year'?4:step==='month'?7:10);
|
|
50
|
+
}
|
|
51
|
+
/** A temporal projection of the already filtered view; no copied or aggregated rows. */
|
|
52
|
+
export class ChartTimeView {
|
|
53
|
+
constructor(view){this.view=view;this.field='';}
|
|
54
|
+
invalidateDomains(){this.domainKey=null;}
|
|
55
|
+
domains(context){
|
|
56
|
+
if(!this.field)return null;
|
|
57
|
+
const key=JSON.stringify([this.field,this.step,context.category,context.fields,context.settings,context.type.id,context.structure.getItem('secondCaptionField'),context.structure.getItem('mapValueField'),context.structure.getItem('mapBarScale')]);
|
|
58
|
+
const geoJSON=context.structure.getItem('geoJSON');
|
|
59
|
+
if(key!==this.domainKey || geoJSON!==this.domainGeoJSON){
|
|
60
|
+
const rows=this.view.getRows().filter(row=>this.value(row,this.field)!=null);
|
|
61
|
+
this.domainValue=chartDomains({getRows:()=>rows,value:(row,field)=>this.value(row,field)},context);
|
|
62
|
+
this.domainKey=key;this.domainGeoJSON=geoJSON;
|
|
63
|
+
}
|
|
64
|
+
return this.domainValue;
|
|
65
|
+
}
|
|
66
|
+
setPeriod(field,value,step,empty='previous'){
|
|
67
|
+
if(!['previous','empty'].includes(empty))throw new TypeError('Empty periods require previous or empty');
|
|
68
|
+
this.field=field;this.date=value;this.step=step;this.empty=empty;
|
|
69
|
+
}
|
|
70
|
+
value(row,field){return this.view.value(row,field);}
|
|
71
|
+
getRows(){
|
|
72
|
+
const rows=this.view.getRows();
|
|
73
|
+
this.snapshotDate=null;
|
|
74
|
+
if(!this.field)return rows;
|
|
75
|
+
if(this.date==null)return [];
|
|
76
|
+
const selected=timePeriod(this.date,this.step);
|
|
77
|
+
let period=this.empty==='empty'?selected:-Infinity;
|
|
78
|
+
const dated=rows.map(row=>{const value=this.value(row,this.field);return {row,period:value==null?null:timePeriod(value,this.step)};});
|
|
79
|
+
if(this.empty==='previous')for(const entry of dated)if(entry.period!==null&&entry.period<=selected)period=Math.max(period,entry.period);
|
|
80
|
+
const snapshot=dated.filter(entry=>entry.period===period).map(entry=>entry.row);
|
|
81
|
+
if(snapshot.length)this.snapshotDate=timeDate(period,this.step);
|
|
82
|
+
return snapshot;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import {defineComponent} from '@gramlot/gramlot/components';
|
|
2
|
+
import {Container} from './container.js';
|
|
3
|
+
import {randomId} from '../random-id.js';
|
|
4
|
+
import {timeProfile,timeLabel,timeDate,timePeriod} from './chart-time.js';
|
|
5
|
+
|
|
6
|
+
const scripts=new WeakMap();
|
|
7
|
+
export function chartTimeLogic(binding){
|
|
8
|
+
if(!scripts.has(binding)){
|
|
9
|
+
const group=`chart_time_${randomId()}`;
|
|
10
|
+
class Logic {
|
|
11
|
+
tick(node){
|
|
12
|
+
const path=node.getAttr('configpath'),config=node.getRelativeData(path);
|
|
13
|
+
if(!config.getItem('timePlaying')||!config.getItem('timeField'))return;
|
|
14
|
+
const next=config.getItem('timeIndex')+1,max=config.getItem('timeMax');
|
|
15
|
+
if(next<=max)node.setRelativeData(`${path}.timeIndex`,next);
|
|
16
|
+
if(next>=max)node.setRelativeData(`${path}.timePlaying`,false);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
binding.logicRegistry.register(Logic,{group,resource:'gramlot:charts'});scripts.set(binding,`${group}.tick`);
|
|
20
|
+
}
|
|
21
|
+
return scripts.get(binding);
|
|
22
|
+
}
|
|
23
|
+
export const ChartTimeline=defineComponent({
|
|
24
|
+
name:'chartTimeline',tag:'gramlot-chart-timeline',base:Container,sourceContext:true,bagStore:true,
|
|
25
|
+
parameters:{storepath:{dtype:'T'},rowMode:{dtype:'T'},configpath:{dtype:'T'},timeField:{dtype:'T',binding:'read'},timeStep:{dtype:'T',binding:'read'},timeIndex:{dtype:'R',binding:'read'}},
|
|
26
|
+
implementation:Base=>class extends Base{
|
|
27
|
+
#context;#bag;#store;#release;#active=false;#syncing=false;#selection;#minimum;#profile;#field;
|
|
28
|
+
constructor(){super();const style=this.ownerDocument.createElement('style');style.textContent=':host{display:none}';this.shadowRoot.append(style);}
|
|
29
|
+
setSourceContext(context){this.#context=context;}
|
|
30
|
+
setStoreBag(bag){this.#bag=bag;}
|
|
31
|
+
projectAttributes(attrs,adapt){const result=super.projectAttributes(attrs,adapt);if(this.#active)this.#connect();return result;}
|
|
32
|
+
connectedCallback(){this.#active=true;this.#connect();}
|
|
33
|
+
#connect(){
|
|
34
|
+
const store=this.#context.sourceNode.rootBuilder.binding.collectionStore(this.#bag,this.parameters.rowMode);
|
|
35
|
+
if(store!==this.#store){this.#release?.();this.#store=store;this.#profile=null;this.#release=store.subscribe(()=>{this.#profile=null;this.#sync();});}
|
|
36
|
+
this.#sync();
|
|
37
|
+
}
|
|
38
|
+
#sync(){
|
|
39
|
+
if(this.#syncing)return;this.#syncing=true;
|
|
40
|
+
try{
|
|
41
|
+
const node=this.#context.sourceNode,path=this.parameters.configpath,config=node.getRelativeData(path);
|
|
42
|
+
const put=(key,value)=>{const old=config.getItem(key);if(old instanceof Date&&value instanceof Date?old.getTime()!==value.getTime():old!==value)node.setRelativeData(`${path}.${key}`,value);};
|
|
43
|
+
const {timeField:field,timeStep:requested}=this.parameters;
|
|
44
|
+
if(!this.#profile||field!==this.#field){this.#profile=timeProfile(this.#store,field);this.#field=field;}
|
|
45
|
+
const profile=this.#profile,step=requested==='auto'?profile.suggested:requested;
|
|
46
|
+
put('timeHasClock',profile.hasClock);put('timeUnit',step);
|
|
47
|
+
const selection=JSON.stringify([field,step]);
|
|
48
|
+
let index=config.getItem('timeIndex');
|
|
49
|
+
const changed=this.#selection!==undefined&&selection!==this.#selection;
|
|
50
|
+
if(changed){index=0;put('timePlaying',false);}
|
|
51
|
+
this.#selection=selection;
|
|
52
|
+
const extent=field&&profile.first?{min:timePeriod(profile.first,step),max:timePeriod(profile.last,step)}:null;
|
|
53
|
+
if(!changed&&extent&&this.#minimum!==undefined&&extent.min!==this.#minimum&&config.getItem('timeValue') instanceof Date)index=timePeriod(config.getItem('timeValue'),step)-extent.min;
|
|
54
|
+
this.#minimum=extent?.min;
|
|
55
|
+
const max=extent?extent.max-extent.min:0;
|
|
56
|
+
if(!Number.isInteger(index))throw new TypeError('Time index requires an integer');
|
|
57
|
+
index=Math.max(0,Math.min(max,index));
|
|
58
|
+
const value=extent?timeDate(extent.min+index,step):null;
|
|
59
|
+
put('timeMax',max);put('timeIndex',index);put('timeValue',value);
|
|
60
|
+
put('timeLabel',value?timeLabel(value,step):'No temporal data');
|
|
61
|
+
if(!extent||max===0)put('timePlaying',false);
|
|
62
|
+
}finally{this.#syncing=false;}
|
|
63
|
+
}
|
|
64
|
+
disconnectedCallback(){
|
|
65
|
+
this.#active=false;this.#release?.();this.#release=null;this.#store=null;
|
|
66
|
+
const path=this.parameters.configpath;
|
|
67
|
+
this.#context.sourceNode.setRelativeData(`${path}.timePlaying`,false);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import bar from './bar.js';
|
|
2
|
+
import line from './line.js';
|
|
3
|
+
import area from './area.js';
|
|
4
|
+
import stackedBar from './stackedBar.js';
|
|
5
|
+
import stackedArea from './stackedArea.js';
|
|
6
|
+
import horizontalBar from './horizontalBar.js';
|
|
7
|
+
import pie from './pie.js';
|
|
8
|
+
import donut from './donut.js';
|
|
9
|
+
import scatter from './scatter.js';
|
|
10
|
+
import bar3D from './bar3D.js';
|
|
11
|
+
import line3D from './line3D.js';
|
|
12
|
+
import scatter3D from './scatter3D.js';
|
|
13
|
+
import surface from './surface.js';
|
|
14
|
+
import map from './map.js';
|
|
15
|
+
import mapBar3D from './mapBar3D.js';
|
|
16
|
+
import map3D from './map3D.js';
|
|
17
|
+
import lines3D from './lines3D.js';
|
|
18
|
+
import polygons3D from './polygons3D.js';
|
|
19
|
+
|
|
20
|
+
export const chartTypes = [bar,line,area,stackedBar,stackedArea,horizontalBar,pie,donut,scatter,bar3D,line3D,scatter3D,surface,map,mapBar3D,map3D,lines3D,polygons3D];
|
|
21
|
+
const types=new Map(chartTypes.map(type=>[type.id,type]));
|
|
22
|
+
export function chartType(id) {
|
|
23
|
+
const type=types.get(id);
|
|
24
|
+
if(!type)throw new TypeError('Choose a supported chart type');
|
|
25
|
+
return type;
|
|
26
|
+
}
|