JfreeChart: scroll a graph horizontally and see old values [duplicate] - graph

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Using JFreeChart to display recent changes in a time series
Before asking, I've been looking for information about my concern with JfreeChart but I have been unable to come out with a solution, so sorry if this question was already posted.
I've programmed an application that receives real-time information from a wireless sensor device (n readings from a temperature sensor every second). To plot this information, I use the JFreeChart libraries, in particular, the DinamicTimeSeriesCollection class.
According with the functionality of this class: "This class is aimed for real-time applications in which we have the ability to append new data and discard the oldest in a pretty fast way (depend on your input data)" (retrieved from JfreeChart: Scroll XYBarChart Horizontally - (chart translation and navigation)), what I need is not to discard the information which has been already plotted. I've seen that I can scroll the graph horizontally by adding a JSlider as it is shown in the aforementioned url. However, I cannot see old values (mostly because they have been replaced).
I'm not sure if I am using the correct class, if there is another libraries like JfreeChart that makes plotting graphs "as easy" or even if there is any trick or method to keep the old values.
Thanks a lot for your time. All the help possible would be appreciated.
Regards
David

A good approach is to store the values that are being received from the device in a 2D listarray (representing x,y coordinates) and pass those points to JFreeChart to be plotted everytime a new value is received. As for panning you can manually set the window with JFreeChart.getXYPlot().get[Domain/Range]axis.set[Upper/Lower]Bounds(double value)

Related

setDataCleaningThreshold for Area Range Series

I saw in version 3.00 there is something called setDataCleaningThreshold , Can you tell its benefits , I think it's for faster loading of progressive charts.
const dcThreshold = xVal - 100;
lineSeries.setDataCleaningThreshold(dcThreshold);
AreaRangeSeries.setDataCleaningThreshold(dcThreshold); // not working
But it's not working for Area range series.
Also there is setMaxPointCount in Area range Series , what is the difference between both ?
My charts are progressive and I want to clear the charts that are out of view and make the charts faster.What is the best way ? Can I use Dispose method ?
Also , can we drag the chart by left click + mouse drag. . I saw something like API for Axis mouse and touch events is released.Can you tell what can be achieved with this.
(right now its right click + drag).
it's not working for Area range series.
setDataCleaningThreshold is new API that will be slowly introduced to existing series. With v3.0 it is only introduced for LineSeries and its derivatives (like PointLineSeries).
To prevent confusion, please refer to official API documentation to see if some method is supported - for example if we look at AreaSeries, it is not part of the API.
Also there is setMaxPointCount in Area range Series , what is the
difference between both ?
setMaxPointCount and setDataCleaningThreshold exist for the same purpose, and effectively achieve the same things, but they are based on slightly different ideas.
setMaxPointCount configures automatic data cleaning by specifying amount of data points to retain at the "head" of data.
setDataCleaningThreshold configures automatic data cleaning by specifying a coordinate on progressive axis. All data points that are "behind" this coordinate can be cleaned whenever convenient. This configuration is slightly preferred over "max points count" as it is more convenient for the rendering engine, and it also behaves slightly more logically - if you apply the fit() operation by dragging to top-left in chartXY with left mouse click, the axis will stop at data cleaning threshold, instead of showing all data including the data behind cleaning threshold.
Both of these methods will be supported for the time being and there should not be major differences between using either, so I recommend use whichever you feel more comfortable with.
Eventually the data cleaning configuration will settle down to a simpler API, but now we're still feeling how different users are using the library, and how we can optimize the performance best - so the API is a bit messy (as in, there are 2 methods for same purpose).
My charts are progressive and I want to clear the charts that are out
of view and make the charts faster.What is the best way ?
For AreaSeries setMaxPointCount is the only automatic option.
Please see the updated documentation on the method to learn more.
You can also implement manual data cleaning using dispose method, as you suggested.
However, please see if automatic data cleaning works for you first.

How to add a text box and show data on Veins Qtenv?

I am using Veins to do some Mobile Edge Computing simulations. To improve the visual effect, I am trying to show real time data of some nodes. For example, my application will return the communication delay in real time. In the Qtenv of Veins, I want to show the delay values in a text box just above the node icon. How to realize that? Or in which documentation can I get some help? Any advice will be appreciated!
Setting a node's Display String (specifically, its t tag) should do exactly that. See https://omnetpp.org/doc/omnetpp/manual/#cha:display-strings for the full documentation.

Trading view pinescript plot my timestamp points

Question #1
Hello! I want to overlay my datapoints on tradingview chart with pinescript I already have my data (order history) like:
0.00002609 buy 1524722057851
0.0000261 buy 1524722057851
Is there a chance to plot them there?
Question #2
Is there any chance to overlay my data on the embedded chart widget on my website?
Thank you so much for any help!
I think you may have found the solution...
Question #1 Hello! I want to overlay my datapoints on tradingview chart with pinescript I
already have my data (order history) like:
Answer: No, I do not think there is such a thing
Question #2 Is there any chance to overlay my data on the embedded chart widget on my
website?
Yes, this is doable. You may need a Pro account, however. As a matter of fact, many crypto exchanges use the TV charting library to display their data. Go through the documentation here: https://www.tradingview.com/HTML5-stock-forex-bitcoin-charting-library/

Compare value at t and t-7days

To get some "visual alerting", I'd like to draw simultaneously two curves on the same graph in Grafana:
current time-window graph
same graph but with 7 days ago data
The idea is to be able to compare data evolution on the same day in the previous week.
I could not find a Graphite function for that (but I may have missed something in the doc).
Is there a way to do it?
You can use timeShift to make a metric in grafana with your series shifted back a week.
This kind of thing is also a good application for series-specific display overrides in grafana, so you can make the shifted series display differently from the current data.

Calculating a Web Audio API filter's response at a specific frequency and Q-factor

I'm using the Web Audio API to make a graphic EQ with four BiQuad filters; a highpass, two bandpass and a low pass:
You can see each node representing each filter's frequency. It's working nicely but I'd like to draw the shape of the filter's roll-off you'd usually find in other graphic EQ's.
I have the Q-factor of each filter and the central frequency. What I would like to do is get a formula that allows me to get the frequency of the roll-off at a specific db value. For example what is the frequency of the roll-off at -200db?
It's been a while since I've done any heavy mathematical stuff and so any help would be greatly appreciated.
Have you looked at the getFrequencyResponse method of BiquadFilterNode? https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html#Methods.
This demo from my IO2012 Web Audio talk uses it: http://webaudio-io2012.appspot.com/frames/frequency-response.html. You'll have to calculate the responses of multiple filters stacked together from there, of course.

Resources