Bar width of XYBarRenderer

A discussion forum for JFreeChart (a 2D chart library for the Java platform).

Bar width of XYBarRenderer

Postby reynard80 » Mon Mar 05, 2018 4:10 pm

I can't seem to get the bars of my XYBarRenderer right.

They keep looking like this, no matter what I tried with setting the stroke and width.

However, I want them to look (exactly) like the volume bars in the candlestick chart (except maybe red for negative bars, green for positive bars as an addition).

How should I do this? I'm using this code so far:

Code: Select all
XYPlot subplot = new XYPlot();

NumberAxis range1 = new NumberAxis("");
NumberAxis range2 = new NumberAxis("");
DateAxis domain1 = new DateAxis ("");

XYDifferenceRenderer renderer = new XYDifferenceRenderer();

XYBarRenderer rendererBar = new XYBarRenderer();

subplot.setDataset(1, timeSeriesHistoDataset);
subplot.setDomainAxis(0, domain1);
subplot.setRangeAxis(1, range2);
subplot.mapDatasetToDomainAxis(1, 0);
subplot.mapDatasetToRangeAxis(1, 1);
subplot.setRenderer(1, rendererBar);
Posts: 5
Joined: Tue Feb 27, 2018 7:45 pm

Return to JFreeChart

Who is online

Users browsing this forum: Google [Bot] and 6 guests