Pre loader

3D scatter plot loses tooltip when the data is updated

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

0
0

Hi thank you for resounding to other questions,

I have having a strange issue. When I add the ScatterRenderableSeries3D to a surface3D, the tooltip3D works. when I add more ScatterRenderableSeries3D it still works. but if I only update the xyzdataseries then the tooltip stops working.

Please see the code below,

            props.data.map(annotationData => {
            //console.log(annotationData)
            if (!sciChart3DSurfaceRef.current.renderableSeries.getById(annotationData?.id)) {
                if (annotationData.x.length > 0) {
                    //console.log("creating data", annotationData)
                    sciChart3DSurfaceRef.current.renderableSeries.add(new ScatterRenderableSeries3D(wasmContextRef.current, {
                        id: annotationData.id,
                        dataSeries: new XyzDataSeries3D(wasmContextRef.current, {
                            xValues: annotationData.x,
                            yValues: annotationData.y,
                            zValues: annotationData.z,
                            metadata: annotationData.metadata // Optional metadata here. Property vertexColor is read to color the point,

                        }),
                        // When metadata colours are provided, the pointMarker.fill is ignored
                        pointMarker: new SpherePointMarker3D(wasmContextRef.current, {
                            size: 2.0,
                        }),
                        opacity: 0.7
                    }));
                }
            }
            else {
                console.log("setting data", annotationData)
                const dataSeries = new XyzDataSeries3D(wasmContextRef.current, {
                    xValues: annotationData.x,
                    yValues: annotationData.y,
                    zValues: annotationData.z,
                    metadata: annotationData.metaata // Optional metadata here. Property vertexColor is read to color the point,
                })
                //console.log(sciChart3DSurfaceRef.current.renderableSeries.getById(annotationData.id))
                sciChart3DSurfaceRef.current.renderableSeries.getById(annotationData.id).dataSeries = dataSeries
            }
        })

When a new renderableSeries is added, the tooltip3d on that data works great! but if I add new dataseries like in else statement the tooltip3d disappears.

Any help is appreciated.

Pramod

Version
3.1.333
  • You must to post comments
0
0

I think you just have a typo in annotationData.metaata when creating the new DataSeries.

More importantly, you are leaking memory by replacing the dataSeries like this. You either need to call
sciChart3DSurfaceRef.current.renderableSeries.getById(annotationData.id).dataSeries.delete()
before setting the new series, or better, reuse the existing series by clearing it and then using appendRange.
const dataSeries = sciChart3DSurfaceRef.current.renderableSeries.getById(annotationData.id).dataSeries;
dataSeries.clear();
dataSeries.appendRange(annotationData.x, annotationData.y, annotationData.z, annotationData.metadata);

Regards
David

  • You must to post comments
0
0

Hello,

I was having the same problem, though my code was a little different. The tooltip works fine with static data and disappears when i update my data with an interval. Code below is how i update the chart.

useEffect(() => {
if (xyzSeriesRef.current) {
const itemCount = xyzSeriesRef.current.count();
if (dots.x.length <= itemCount) return;

xyzSeriesRef.current.appendRange(
dots.x.slice(itemCount),
dots.y.slice(itemCount),
dots.z.slice(itemCount)
);
}
}, [dots]);

I have a state in my parent component and just pass it down to my chart. It updates the chart as expected but the tooltip stops working. Couldn’t figure out whats wrong.

  • Jim Risen
    Hard to tell without a context. Please create a new topic and provide an example we can run to reproduce the issue. Preferably via CodeSandbox or CodePen. This way we would be able to quickly confirm and identify whether there is a bug in the lib functionality.
  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.