candlestick and line graph

Discussion about JFreeChart related to stockmarket charts.

candlestick and line graph

Postby amlwwalker » Sun Oct 07, 2012 3:17 pm

Hi, So I am new to jfreeChart but getting along nicely.
I have succesfully got it plotting candlesticks in real time I am using a OHLCDataset[]. I want to plot some trendlines on the same graph. I can get the open/close data etc out of the list of OHLCDataItem's and create a new data set of them - Date/Time against Open/close etc, however Im not sure how to plot that data on the same graph.
Here is the current dataloading code:
Code: Select all
            List<OHLCDataItem> results = thread.getResults();
            OHLCDataItem[] dataItems = results
                  .toArray(new OHLCDataItem[results.size()]);
            generalDataSet = new DefaultOHLCDataset("graph",

results is storing all the data.
So I create a new List of (Im not sure what type - I want Date against 1 other piece of data?????) and add the date and open/close to it from results.

Then Im doing:
Code: Select all
      mainPlot = new XYPlot(generalDataSet, domainAxis, rangeAxis,
      candleStickRenderer.setSeriesPaint(0, Color.BLACK);

Now I want to plot the other set of data as a line graph (for now):
Code: Select all
      mainPlot.setDataset(1, [**OTHER DATA SET**]);
      mainPlot.setRenderer(1, LineRenderer);

Is that all I need to do to plot it on top of the same graph? If so, then my only question is what data type can store a data/time value and one double value in a list?

Posts: 1
Joined: Sun Oct 07, 2012 3:09 pm

Return to JFreeChart - Stockmarket

Who is online

Users browsing this forum: No registered users and 1 guest