I have to place 4 spines on the same chart with different Y ratios, so I need to set up 4 Y-axes.
I have read the "muti-axis" demo from QT creator, it shows a example of two Y-axis and the two Y-axis are put on left and right side.
It's good when there is only two spines,
but when I have 4 spines, how to relocate the 4 Y axis?
Is it possible to place the 4 Y-axis at the tick point of X-axis? like the image below.
I used ChartJs2QML for displaying charts in QML.
Below is the approach I followed for multiple y axes. Maybe a similar approach can be adopted in Qt as well.
Show labels of all the y axes in the legend.
Show only one y axis by default. Hide all the other y axes.
On click of any y axes label in legend, hide the active y axis and show the clicked y axis.
Related
I'm developing a Qt5 application with QWidgets. I’m using QwtPlot from the Qwt-library for plotting live data in my tool. I'm setting my plot-axis to auto-scale via ui.qwtPlot->setAxisAutoScale(axis), because I want my plot to automatically adjust to the incoming data.
Now some clients are requesting the possibility, to have a plot with equally spaced axes x and y. I found QwtPlotRescaler, which seems to be the right thing for this purpose. I’ve successfully added it to my plot which now has equal axes if needed. (I can disable / enable this functionality by an additional button.)
However I noticed, that the auto-scale functionality is disabled, whenever I activate equal axes. With my dynamically incoming data, I would still like to have a rescaling plot. The axes should be automatically growing and shrinking, whenever the contents (items in the plot) change. So just like the normal autoscaling, but keeping the axes equal in the meantime. How can I archive this?
Do you need any additional information?
Thanks for your help!
Let's say your y axis should depend on the x axis, so that you always have a fixed aspect ratio for your coordinate system.
Then Qwt has to adjust the range of y axis and has to ignore the bounding interval of the data in y direction - there is no solution to do both.
What could be done is to add extra margins to the x axis, so that the range of the y axis grows according to the aspect ratio - finally including the bounding interval of the data. But finding good margins to achieve this is not implemented by QwtPlotRescaler.
But if it helps: all what the autoscaler does is to adjust the scales according to the boundingRect of the curves. You can also do this on your own, whenever you change your data.
I'm having some trouble with my right axis ticks with chartjs. You can see in the images I'm adding and removing different axis and it automatically puts them in the left or right side, but sometimes you can see that the numbers in the right axis are not aligned with the gridlines and sometimes they are aligned.
This just happens in the right side and you can see is not because of the information that it brings because there's an example in the images where I select one of the axis that has that error and put it to the left side (Hydrocarbon detector). I'm using Chartjs V2.7.2.
Can anyone help me with this issue please?
example with 6 axis, hydrocarbon to the right
example with 5 axis, hydrocarbon to the left
example with 6 axis, hydrocarbon to the left
example with 5 axis, hydrocarbon to the left
In v2.0-beta, is there a way to configure the tooltip corresponding to that x-position to show up when hovering anywhere above that point on the axis? for example, the functionality shown here:
https://blockchain.info/charts/market-price
As you trace the line horizontally, you are shown the tooltip corresponding with your distance from the y-axis.
What the tooltip shows in your example is the y value corresponding to the distance from the y-axis (i.e. the x value).
Unless you want to extrapolate between data points (not usually a good idea for data like that shown in your example, since you don't know that its going to follow your extrapolation), this means that you need to have data values for all points where you want to show the tooltip.
With that your question is basically about showing every n x axis labels. https://stackoverflow.com/a/31606933/360067 does this similar for the current stable version of Chart.js. For v2.0-alpha, the option you need to be adjusting is scales.xAxes.labels.template.
Is there a way to have different font-sizes for X and Y axis using ChartJS.
scaleFontSize always applies to both axes.
I use the Y-axis with custom scaleLabel's which are LineIcons. I'd like to have those bigger while maintaining the size of the X-axis labels. A workaround will do as well.
I can't figure out why Google Charts draws this simple chart aligned to center and doesn't fill entire white area.
Note: X axis is discrete because it represents weeks.
Do you have any idea what can I do with it?
That is how the charts display when you use a discrete (string) axis. If you want edge-to-edge lines, you need to use a continuous (number, date, datetime, timeofday) axis. See an example of the differences here: http://jsfiddle.net/asgallant/Xfx3h/.