How to create a VictoryCursorContainer where a Scatter would appear on hover over the cursor line - victory-charts

I am trying to implement a Scatter point that follows the VictoryCursorContainer hover line (as seen in image).
Is setting the Scatter coordinates through updating a state in the onCursorChange handler the best way to achieve this ?
I tried doing a version of this here: https://codesandbox.io/s/scatter-victorycursorcontainer-forked-b1irbl
It seems like it's a bit laggy and the Scatter is rendered behind the line and the Cursor line.
Would appreciate any help / pointers here

Related

Qt [PySide6] visual artefacts with custom paintEvent

I'm trying to have a custom painting of a pyqtgraph derived Plot widget (the code is found here https://github.com/danielhrisca/asammdf/blob/bfa09d0b46f1b4b98b9ad1d0a0bb90cbb876b43e/asammdf/gui/widgets/plot.py#L4271): since painting a Plot with thousands of curves is very expensive I want to store the result in a QPixmap, then if I have a cursor active (implemented using an InfiteLine (see https://github.com/pyqtgraph/pyqtgraph/blob/6ed7d4fa4762aaa895f7e9b2fb09ec6df4cc793f/pyqtgraph/graphicsItems/InfiniteLine.py#L16) I would first draw the QPixmap on the viewport then on top just the cursor item. This way moving the cursor would not trigger the repaint of all the curves.
The QPixmap looks like this
and this is what happens when I create a cursor and slide it around:
Note that at the end the plot is zoomed out, this causes the reset of the QPixmap and the "native" repaint which produces the correct image with the single vertical line of the cursor.
What could be causing this?
I found the problem to be that the paint events were set to update just certain regions of the viewport instead of the full viewport.
The fix was to set the viewport update mode to full update
self.setViewportUpdateMode(QtWidgets.QGraphicsView.FullViewportUpdate)

How to align correctly this SVG inside the Victory Scatter Graph

I have a problem with aligning the SVG component DataPointCircle inside the Victory Scatter Graph.
My main problem is not how it looks but how it acts.
the tooltip and the VictoryVoronoiContainer is acting weird when hovered over the data circles.
When the data circle is hovered it sometimes shows the tooltip sometimes not!, this is more clear on the last data point.
Since I had to do this x={x - 10} y={y - 10} to properly align the data points, I thought that maybe it is causing a distortion.
I need the tooltip and VictoryVoronoiContainer to act normal. I'm 100% if it is an aligning problem or if I need to do something else, suggestions would be lovely!.
Thanks in advance.
Here is a SandBox
https://codesandbox.io/s/YED2ql2mK
The answer was posted in github:
Yes, that [manually add offset props x={x - 10} y={y - 10}] would definitely be causing the issue. VictoryVoronoiContainer calculates the positions of all of your data points. If you move the points around manually, the triggers will no longer match up. I don't think this is something I can fix at the library level. It might be better to add the tooltips directly to VictoryScatter so that they will be attached to your custom point components regardless of how you you manually position them
https://github.com/FormidableLabs/victory/issues/695

Showing a cross-hair programatically in Highcharts

Has anyone been able to successfully render a cross-hair programatically in Highcharts?
I have a visualization playing an animation through time and I would like to co-relate the position on the chart via the crosshair. I find that visual cue better than selecting the point on a series. Thanks!
Although Highcharts has something called a cross-hair, I guess what I'm looking for is a plot line.
I've found documentation here and an example scenario
EDIT: I've also noticed that marker.enabled must be set to false or the plot line doesn't show.

How to add crosshair vertical line in line graph using Core Plot framework?

I am using core plot framework for drawing the line graph in iPhone and it is working fine.I am displaying system time on X- axis and Temperature on Y- axis.I need to draw the cross hair vertical line that indicate the selected value on the line graph. for example
I would highly appreciate if someone can give me some suggestion to solve this issue.
Thanks in advance.
You can use another axis or scatter plot to draw the line. Using an axis is simpler if all you need is a single horizontal or vertical line. Set all of the tick and grid line styles to nil and use the orthogonalCoordinateDecimal to position it in the correct location. There is a demo using a scatter plot to draw a crosshairs over the selected point in the Mac version of the CPTTestApp example app.

how to change a point color, style or size in line chart using achartengine android

I'm developing an app now with achartengine to draw a line chart. Now I have a problem with an effect that I hope to fix. The effect is, when users touch a point on the line chart the color or style of point can be changed to different color or style. But the other points should remain the same as before.
I was not able to find any function to set a point color or style on achartengine API document.
Can someone please point me to any documentation that can help me with my problem?
There isn't such API available. However, you could create a temporary series that would contain one single point (the selected one), add it only as long as you need it and when no longer needed, just remove it from the dataset.

Resources