HighLowDataset and TimeSeries

Discussion about JFreeChart related to stockmarket charts.
Locked
Markus
Posts: 1
Joined: Tue Sep 09, 2003 2:18 pm

HighLowDataset and TimeSeries

Post by Markus » Tue Sep 09, 2003 2:41 pm

Is it possible to combine TimeSeries data and HighLow data in the same chart?

Also, I have an array of price data where each element has a time code (e.g. L1, L3 or M1) and a price. This I would like to turn into a HighLow chart with a vertical bar for each time code. I've got a method to convert the time code to a time string "HH:mm". The same time code can occur multiple times. Do I first need to trim this data to exclude multiple values? What is the best DataSet to do this?

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Re: HighLowDataset and TimeSeries

Post by david.gilbert » Tue Sep 09, 2003 5:39 pm

Markus wrote:Is it possible to combine TimeSeries data and HighLow data in the same chart?
Yes, you can add a secondary dataset and renderer to a time series chart - the secondary renderer can be a HighLowRenderer.
Markus wrote:... What is the best DataSet to do this?
The HighLowRenderer expects a dataset that conforms to the HighLowDataset interface. Your best option is probably to write a class that wraps your data array and implements the HighLowRenderer interface.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

TNT

found a solution

Post by TNT » Mon Nov 17, 2003 1:49 pm

My solution

---------------------------------
HighLowDataset dataset = pgraph.createhighlowdataset();

TimeSeriesCollection dataset2 = new TimeSeriesCollection();
dataset2.addSeries(lmme2fi);


JFreeChart chart = ChartFactory.createCandlestickChart("Candlestick Demo",
"Time", "Value",
dataset, true);


StandardLegend legend = (StandardLegend) chart.getLegend();
legend.setDisplaySeriesShapes(true);
XYPlot plot = chart.getXYPlot();

NumberAxis axis2 = new VerticalNumberAxis("F Ind");
axis2.setAutoRangeIncludesZero(true);
plot.setSecondaryRangeAxis(axis2);
plot.setSecondaryDataset(dataset2);
XYToolTipGenerator tooltipGenerator = null;

XYURLGenerator urlGenerator = null;

plot.setSecondaryRenderer(new StandardXYItemRenderer(StandardXYItemRenderer.LINES, tooltipGenerator, urlGenerator));
plot.setSecondaryDataset(dataset2);

---------

Well, i'm looking for the samething, but just with a single Axis..

like a CandlestickChart with two average ??

Any solution ???

thanks ...

Locked