ABTSoftware / SciChart.JS.Examples

MIT License
81 stars 38 forks source link

Linking 2D and 3D charts #208

Open Bobby-88 opened 6 months ago

Bobby-88 commented 6 months ago

Hello. I'm working on a visualization of flight trajectories and i would like to have a view with 1 big 3D view for trajectory visualization and several smaller 2d graphs for different scalar values. I've selected SciChart as i like it's "techy" look and i am believer of wasm for such applications.

Now everything works great, but I would like to implement a sync between 2d chart and 3d chart. You have this functionality between 2D and 2D charts via new RolloverModifier({modifierGroup: "group1"}) but i don't see how to do that between 2D and 3D. I understand you will not develop it just because i'm asking - and that makes total sense. However, i want to ask you on the possible way forward: here are the options as i see them:

  1. programatically reading which point you have selected in 2d chart and programatically setting it on 3d chart. 2.programatically reading which point you have selected in 3d chart and programatically setting it on 2d chart.

i've found some :TODO in your examples here Examples/Charts2D/TooltipsAndHittest/DatapointSelection/index.tsx which suggests there may be a way to do this... I'll appreciate your response.

antichaosdb commented 5 months ago

Sorry for not spotting this earlier. Send questions to support@scichart.com for quickest replies.

You are right that modifier sync between 2D and 3D charts does not just work. This is because they use separate wasm instances so you cannot do the kind of low level data sharing that is possible between 2D charts. However, doing this programmatically via the hitTest api is definitely possible. Docs at https://www.scichart.com/documentation/js/current/webframe.html#Hit-Test%20API.html. HitTest for 3D is fairly new and not well documented yet, but the api is basically the same was as in 2D. As such both options 1 and 2 are possible.

The suggested approach is to wrap your hitTesting in a custom modifier (https://www.scichart.com/documentation/js/current/webframe.html#CustomChartModifierAPI.html) rather than adding extra even subscriptions to the canvas. SciChart handles all those events internally and deals with cleaning up after.