Histogram - a few questions

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Traxer
Posts: 15
Joined: Tue Jan 31, 2012 9:06 pm
antibot: No, of course not.

Histogram - a few questions

Post by Traxer » Tue Feb 28, 2012 7:41 pm

Hi,

I like to use a histogram chart, but I got 2 problems:

- the chart exists of continous data input, but how can I update the histogram??? There is no edit methode....

- is it possible to set 2 markers in the x-axis? And change them later?

Any ideas and workarounds are welcome....

Thanks a lot!

Markus

matinh
Posts: 483
Joined: Fri Aug 11, 2006 10:08 am
Location: Austria

Re: Histogram - a few questions

Post by matinh » Wed Feb 29, 2012 8:11 am

Hi!

Please do the following:

1) read How to ask a question
2) search this forum and find the answers to your questions there

- martin

Traxer
Posts: 15
Joined: Tue Jan 31, 2012 9:06 pm
antibot: No, of course not.

Re: Histogram - a few questions

Post by Traxer » Wed Feb 29, 2012 10:21 am

Thanks a lot!!! Thats exactly what I´m looking for :(

1.) The topic (I guess this is what you mean?) points to histograms and this subject isnt very wide...
2.) I have stilled searched the forum and google, but mayby you could be so kind to post a link :?:

But ok,....

In the meantime I tried a lot with the histogramdatasets "HistogramDataset" and "SimpleHistogramDataset". The first one does exactly the things I need (HistogramType.RELATIVE_FREQUENZY ) but doesnt support any data adding methods! The second one is fine for updating the chart with data, BUT the graph only displays the number of data belongs to each bin (setAdjustForBinSize(false) ), or a value that I dont understand setAdjustForBinSize(true)!

matinh
Posts: 483
Joined: Fri Aug 11, 2006 10:08 am
Location: Austria

Re: Histogram - a few questions

Post by matinh » Wed Feb 29, 2012 10:49 am

Traxer wrote:Thanks a lot!!! Thats exactly what I´m looking for :(
No need to be sarcastic. I just pointed you to some rules that should be respected on this forum!
1.) The topic (I guess this is what you mean?) points to histograms and this subject isnt very wide...
The subject wasn't perfect but that's not what I referred to. As both, markers and updating datasets has been asked and answered before on this forum, I wanted you to search the forum before posting!
2.) I have stilled searched the forum and google, but mayby you could be so kind to post a link :?:
Maybe you should have searched a bit harder...

Regarding dataset updates I found this in about 20 seconds. It's not specific for HistrogramDataset but it basically works the same for all kind of dataset.
Regarding markers: finding the answer to modifying markers took me about one minute.
Adding more than one marker is possible. Trying this out would probably be faster than asking and waiting for an answer.

- martin

Traxer
Posts: 15
Joined: Tue Jan 31, 2012 9:06 pm
antibot: No, of course not.

Re: Histogram - a few questions

Post by Traxer » Wed Feb 29, 2012 11:15 am

Regarding dataset updates I found this in about 20 seconds. It's not specific for HistrogramDataset but it basically works the same for all kind of dataset.
Great Link.... :shock: !
But the HistogramDataset has no method for adding data continuosly. I can only put an array into the dataset and thats it. So I think, I have to rebuild the whole dataset for any new data I will receive. The link shows no soltions anyway! But maybe you can give me a hint, how to remove and replace series in the dataset...

matinh
Posts: 483
Joined: Fri Aug 11, 2006 10:08 am
Location: Austria

Re: Histogram - a few questions

Post by matinh » Wed Feb 29, 2012 11:29 am

But the HistogramDataset has no method for adding data continuosly. I can only put an array into the dataset and thats it.
What about calling the addSeries() Method again with new/updated values?
That should update your chart.

- martin

Traxer
Posts: 15
Joined: Tue Jan 31, 2012 9:06 pm
antibot: No, of course not.

Re: Histogram - a few questions

Post by Traxer » Wed Feb 29, 2012 11:38 am

matinh wrote:
But the HistogramDataset has no method for adding data continuosly. I can only put an array into the dataset and thats it.
What about calling the addSeries() Method again with new/updated values?
That should update your chart.

- martin
If I use the addSeries() Method again, then I will add a series. But the existing series will be still in the histogram. Even if I cant remove any series my only Idea is to drop the whole histogram and build a new one... You see, I isnt a simple as it seems

matinh
Posts: 483
Joined: Fri Aug 11, 2006 10:08 am
Location: Austria

Re: Histogram - a few questions

Post by matinh » Wed Feb 29, 2012 11:47 am

HistgramDataset seems to be a bit odd here compared to most other datasets.
You could try extending it and add a removeSeries(int series) or updateSeries(int series, [other args]) method.
Or you could just implement your own XYIntervalDataset which suits your needs. This shouldn't be too hard.

- martin

Traxer
Posts: 15
Joined: Tue Jan 31, 2012 9:06 pm
antibot: No, of course not.

Re: Histogram - a few questions

Post by Traxer » Wed Feb 29, 2012 11:57 am

matinh wrote: This shouldn't be too hard.
:lol: For me it will be impossible....
Therefore I´m looking for some code examples or existing workarounds.

Locked