Results 1 to 1 of 1
- 10-07-2012, 01:18 AM #1Member
- Join Date
- Oct 2012
- Rep Power
jfreechart plotting line chart on candlestick chart
Hi everyone, new to this forum.
Im learning about plotting graphs in Java, and have had success plotting a candlestick graph in jfreecharts. I have now plotted a line graph on top of that. The problem is my line graph is currently plotting from the same dataSet as my candlestick chart and is plotting the closing points. I want to be able to decide which points of the OHLCDataItem to plot. I.e I may want to plot the "open" variable as a line chart or whatever. Also, OHLCDataItem OHLCDataItem want four data points, whereas for my line graph, I just want the date, and another variable of my choice.
These are the lines that are relevant:
List<OHLCDataItem> data = getData(stockSymbol); OHLCDataItem dataItems = data.toArray(new OHLCDataItem[data.size()]); XYDataset generalDataSet = new DefaultOHLCDataset(stockSymbol, dataItems); XYPlot mainPlot = new XYPlot(generalDataSet, domainAxis, rangeAxis, candleStickRenderer); mainPlot.setDataset(1, generalDataSet); mainPlot.setRenderer(1, LineRenderer);
generalDataSet turns that into data that the candlestick graph plots. mainPlot plots that data on the graph, then the next two lines change the renderer to the line graph plotter, but still using the same data set, and this is where Im no sure how to select which of the five doubles to plot against the date.
Any one done this?
Any examples would be greatly appreciated.
- By ginger0001 in forum New To JavaReplies: 0Last Post: 03-20-2012, 04:23 PM
- By saneel4u in forum Advanced JavaReplies: 5Last Post: 07-06-2011, 04:11 PM
- By lowlyintern in forum Advanced JavaReplies: 3Last Post: 08-11-2010, 03:58 PM
- By Java Tip in forum java.awtReplies: 0Last Post: 06-23-2008, 11:22 PM
- By levent in forum Java SoftwareReplies: 0Last Post: 08-03-2007, 04:41 PM