customize x-axis interval for a real time line chart in achartengine - grid

I have a real-time line chart. For that I use TimeSeries. Now I get new values every second. But I don’t want to get a x-axis line every second. I like to get one every ten seconds.
So maybe, first it would be important to know where the x-axis lines were painted. Is it xymultipleseriesdataset.addSereies(timeSeries)? So maybe I can create a loop that add every 10 second a new title for the x-Axis... or am I totally wrong?

If I am right, you are asking for a way to control which labels are shown on the x-axis.
To do that, you may use the XYMultipleSeriesRenderer.addXTextLabel(timeInMillis, "requiredlabel").
This will cause the automatic generation of labels to stop and you can then have complete control on which labels are shown and which are not.
Edit:
Seems like I was wrong about automatic generation of labels stopping.
Use the method XYMultipleSeriesRenderer.setXLabels(0) to stop the generation of labels. This method is used to set how many labels should be generated for the x axis. Passing 0 should stop automatic labels to stop altogether.

Related

How to plot only within a range defined by x number of bars?

I understand that I can contingently plot on the chart using range of date and time values.
However, I would like to be able to plot using a specific number of candlesticks.
For example, I would like to be able to say something like
// Within the most recent 10 bars
// If close[0] > close[1]
// plotshape()
I have tried implementing numerous variations using barstate.isrealtime or barstate.islast but I keep running into limitations.
One major problem is that, although bar_index[#] works by indexing backwards from the most recent bar, the value of bar_index[10] is not 10 but some number in the thousands (depending on the timeframe of the chart — for me its Daily = 2,616 candles, 1hr = 6,217 candles, 15m = 5,222, etc.). In other words, it counts the number of bars from the oldest bar available.
Since referencing of the bars (starting from most recent) and the index values (starting from the oldest) are conflicting--due to counting from opposite ends--I am not sure how to specify: plotshape() for the most recent 10 bars.
I am also running into trouble due to the fact that bar_index[0] occurs every single iteration of the chart's timeframe--so I am getting caught in recursive calculations when trying to do bar_index[0]-bar_index[10].
It seems that what I need is something like bar_index.islast[10]
The reason that I would like to call a plotshape() based on the number of specified candles versus since x date/time (or within date range (x,y)), is because I want my indicator to function properly regardless of which timeframe my chart is displaying:
If I am showing a monthly chart, I want to plot across the last 10 monthly bars; If I am showing a daily chart, I want to plot across the last 10 daily bars; etc.
If I am forced to use a date range, then this functionality breaks down, since I will be shown increasingly more bars for smaller timeframes.
Caveat**
I am able to kinda make this work by specifying the number of bars from the oldest candlestick by stating something like:
bar_index > 2600 ? color=color.black : na
However, given the fact that every single time frame displays a different number of bars, this is not a workable solution for me.
Thanks for any advice.
UPDATE
I have been hunting around and and found that the functionality I desire is already built into the show_last argument of the various plot()functoins.
Ill leave my question posted, in case it helps someone else.
UPDATE I have been hunting around and and found that the functionality I desire is already built into the show_last = int argument of the various plot() functions.
I'll leave my question posted, in case it helps someone else.

Split x axis for every value in graph, in Power BI

I have the following graph in Power BI:
and I'm trying to recreate the below graph from Excel (note the X axis with the months February and January, with the Operation Text:
As you can see, my attempt only displays the Operation Text rather than the month and Operation Text).
Here is what my current axis looks like:
Changing the axis to have Actual Start Date on top, rather than the Operation Text:
Makes my graph look like this:
Is it possible to achieve the same outcome as in Excel, with the values in my graph showing the two months side by side, for each operation text? If so, how can I do this?
I've tried looking into the X axis 'format' settings and wasn't able to see anything obvious to help achieve this. In addition, unfortunately the graph I'm looking to recreate is only a screenshot so I am unable to see how it achieves that outcome.
EDIT:
As suggested, I attempted to place Operation Text into the Legend field in my Visualisations section but I am unable to, due to the fact that I have two Value fields (the two columns Actual Hours and Estimated Hours).
#CR7SMS is correct. You just need to expand down to the next level using that split arrow in the upper right of the visual so that this:
Becomes this:
Note that to get the axis to look like this, you'll need to sort on month rather than one of the measures.
You'll also want to turn off 'Concatenate labels' toggle in the 'Format > X axis' section of the visual settings.
You would have to drill down one level, using the arrows seen at the top right of your first screenshot. For your specific purposes, the split arrow should do the trick. Hope this helps.
Have you tried moving your date or operation text column in legend section ?..not 100% but something close to your requirement you can achieve

JavaFX - Logarithmic Slider Tick Marks

I was wondering if there is a way to make a JavaFX Slider to show logaritmically spaced tick marks. I suspect there is none. If this is the case what would be the best way to go about implementing this do you think? I should mention that I have seen this but the accepted answer is not what I want.
So what I know is possible is this:
But I want are tick marks spaced like this: http://www.dplot.com/logarithmic/loglin_h600.png
That the tick marks show their respective values is not important.
Thanks for your time.
You can use a linear Slider with linear tick marks and every time you get a result you calculate the logarithmus of it and work with that.

Hide/show multiple graphs in qcustomplot

I am making a data logger for a couple of Arduino sensors in Qt. The problem is that I want to log the data in 3 different graphs, each of one having one specific scale, and then I'll choose what graph I will show (just one of the 3 graphs will be displayed at one time).
I tried something like this:
QCPGraph *sensorXGraph = ui->graph->addGraph();
QCPGraph *sensorYGraph = ui->graph->addGraph();
sensorXGraph->setVisible(false);
sensorYGraph->setVisible(false);
And then, in a slot call from a RadioButton clicked event I did:
sensorXGraph->setVisible(true);
sensorYGraph->setVisible(false);
And the inverse for another RadioButton. But the graph seems to keep the axis of the last graph created. So, if I try to see the sensorXGraph, the data will change accordingly but y axis range will be the one of the sensorYGraph.
I also tried to make a single QCPAxis for each graph, but it started to be a mess because I had to make QCPAxisRect for each graph as well and the result was worse than the first trial.
How do I achieve to change from one graph to another properly?
Thank you in advance.
You can call clearGraphs() on your QCustomPlot and then add whatever graphs you want to display by calling addGraph() and then call replot() on your QCustomPlot. So it would be something like this:
ui->graph->clearGraphs();
ui->graph->addGraph();
// Do whatever you need to do to edit your graph.
ui->graph->replot();
Since you are using a radio button I think that it would be easier to draw one graph and add the necessary data and labels based on whatever radio button has been selected. Hopefully that helps!

How to set two identical y-scales in the same graph in Labview?

When a graph is very wide I want to show the y-axis values also on the right side of the graph so it becomes easier to read the corresponding values of the lines.
I know how to duplicate the left axis to the right. And when the graph is created I use ActYscl to set the range of scale nr 0 (left) to scale nr 1 (right). This works when the graph is created and also the zoom and pan function work on both y-scales. However, when I use the Autoscale function of the Graph Pallet, only the initial axis is scaled (probably because the graph data are only linked to the original axis).
Is there a way to make the autoscale function work for both y-axis at the same time?
Charts and graphs have an Autoscale Range Change event. Use an event structure to catch this event and update the range of the duplicate scale to match the first one:
I've used a chart for this example as it's simpler, but it should work the same for a graph. Of course you need a way of telling the event loop when to exit; I've used the Value Changed event of the stop button. If your application uses an event-driven structure anyway, you should just be able to add the autoscale event to your existing event loop.

Resources