I have plotted a graph using zedgraph library as shown in figure.On x axis zedgraph automatically plotting values between range in our case 1 to 20 its not showing intermediate values i.e. 1,2,3,4....20 I want show point 1,2,3,4,5...20 as well.How can I do that??
MajorStep
Gets or sets the scale step size for this Scale (the increment between labeled axis values).
http://zedgraph.sourceforge.net/documentation/default.html
See Scale Class, scroll down to MajorStep
Or http://www.nudoq.org/#!/Packages/ZedGraph/ZedGraph/Scale/P/MajorStep
.GraphPane.XAxis.Scale.MajorStep = 1;
.GraphPane.XAxis.Scale.MajorStepAuto = false; // Not needed, see documentation.
Related
I want to create a plot that shows the live metering data I am getting from an electricity meter.
I already figured out how to have a plot in bokeh, that updates every x seconds with new values, but now I want to have the new values always be at a fixed point in the plot, while the range of the axis does not increase.
I fixed the range by adding x_range=[0, 10] to the figure, however that plot is running out of the screen and I have to manually follow it.
How do I change it so it follows it automatically?
Is that even possible in bokeh or should I be using something different for my project?
Use a default DataRange1d range (i.e. do not set the range to a fixed interval) and then set the follow property on the range. You can also set follow_interval to specify how far back the range should trail the latests data.
p.x_range.follow = "end"
p.x_range.follow_interval = 100
For a complete demonstration see the OHLC ticker example.
I am creating the chart from database values (two series). The values are in the range 0 - 1. When axis are created by command:
chart->createDefaultAxes();
Then graph looks like this (note the maximum value 0,941):
I would like to have the range of Y axis from 0 to 1 exactly. But when the axes are created explicitly
QValueAxis *axisY = new QValueAxis(chart);
chart->setAxisY(axisY);
axisY->setRange(0,1);
axisY->setTickCount(11);
then the values are "stretched" to 100% of range and graph is showing unreal values. Both lines have the maximum 1.0 which is not what is in database.
How to prevent the values "stretching"?
I found the solution. When axes are attached using commands below everything is working:
chart->setAxisX(axisX,chart->series().at(0));
chart->setAxisX(axisX,chart->series().at(1));
chart->setAxisY(axisY,chart->series().at(0));
chart->setAxisY(axisY,chart->series().at(1));
But it is not clear for me, why the following simple commands are not working:
chart->setAxisX(axisX);
chart->setAxisY(axisY);
I was expecting that if series is not specified then axis will be used for all series implicitly. And if axes are not automatically used, why the values are "stretched"? This is not expected behaviour...
I'm having problems with the y axis on a custom XYChart. The y axis is a NumberAxis, and I set the tick label formatter to a custom formatter. Auto-ranging is off. When I change the upper bound of the chart and request an axis layout, the old labels remain on the chart. With debug logging, I can see that the custom formatter methods are being invoked, and that they return the correct Strings, but the tick labels on the chart do not update. The only ones that do update are the ones that were not on the axis before. For example, if the range of the y axis was 0 to 3, and then I change the upper bound from 3 to 5, new labels with the correct values will show up at indices 4 and 5. However, the labels for 0 through 3 do not update even though the custom formatter now returns different Strings for them.
I tried taking the custom formatter out of the equation and simply changed the tick label fill to another color when I changed the upper bound of the y axis, and I saw the same behavior (labels for pre-existing indices had the old color, and labels for new indices had the new color). I hope I'm missing something obvious. Any help would be greatly appreciated. Otherwise I may need to resort to recreating the chart whenever the y axis labels need to change.
From what I have found, the tick labels themselves are basically immutable. Once a range is set, it only adds and removes ticks, but doesn't update them. What I did to overcome this is to set the upper bound to the lower bound (effectively removing all ticks), and then setting the upper bound back to the range I wanted, so it would re-create the ticks.
I have a colored waterfall display implemented as a QwtPlot with a data container derived from QwtRasterData (m_SpectroPlot below). The values painted correspond to the Z-axis of the data, taken from a color map that is shown on the right side of the plot. The code looks like this:
const QwtInterval zInterval = m_SpectroPlot->data()->interval( Qt::ZAxis );
QwtScaleWidget *zAxis = axisWidget(QwtPlot::yRight);
zAxis->setColorBarEnabled(true);
zAxis->setColorMap( zInterval, new ColorMap());
setAxisScale(QwtPlot::yRight, zInterval.minValue(), zInterval.maxValue() );
setAxisAutoScale(QwtPlot::yRight);
enableAxis(QwtPlot::yRight);
Everything works fine, but I want to have the color map on the left side and hide the Y-axis values. When I replace yRight with yLeft in the above code, the displayed interval of the color map is locked to the interval of the data's Y-values. How can I maintain the current independent axis intervals while showing the color map on the yLeft axis?
In other words, I want to display the color map for the interval Z0-Z1 on the yLeft axis, while the actual Y-values drawn on the plot are Y0-Y1. It seems like I need to somehow tell the plot to use yRight instead of yLeft to scale the Y axis.
After sifting through some documentation I found the answer. The data needs to be told to attach to the yRight axis instead of the default yLeft.
m_SpectroPlot->setYAxis(QwtPlot::yRight);
I have a Flex line chart where I allow the user to change the y axis ranges. When a data point falls outside the ranges, the chart drops the line segments on either side of the out of range point leaving a gap in the data line.
I'm currently using the data function to clamp the values out of range to the y axis min/max, but this displays misleading data.
Is there a way to make it draw the lines to the y axis max/min point, making it look like the line goes off the plot?
There is a parameter filterDataValues in LineSeries - set it to "none" and it should do the trick.