Question 1)
I've got 7 valueAxis as range-axises and 1 timeAxis as domain-axis. I've got 7 TimeSeriesCollection datasets, each with it's own StandardXYItemRenderer. Now, when he chart gets painted, each dataset gets it's own color (a color which gets set automatically). So each dataset line has it's own color.
Now, I want the labelPaint for each valueAxis to get the exact same color as each dataset renderer. I've tried setting the labelPaint for each valueAxis via alueAxis[a].setLabelPaint(renderer[a].getSeriesPaint(0)) where a is the index of an axis and renderer. It won't work because somehow the color that each dataset gets isn't defined until rendering. The only way I could figure out how to do it was to override paintGraphics for the ChartPanel and inside that function call the setLabelPaint. This worked because now the dataset lines had already been painted with respective color. This wasn't good for a few reasons however (slowing graphics down while zooming).
So, how would I go about having the samel labelPaint on an axis as the paint for the dataset renderer the axis corresponds to?
Question 2)
When I resize the JFrame I have my ChartPanel in it all gets funkily large. One would think only the actual graph area would become bigger, but everything becomes bigger. Text/lines/legends/etc. It looks very weird. I'll need to supply screenshots here to better give you an idea what's wrong. First you see a normal sized window, then you see the window when I've enlarged it.
link removed
link removed
Question 3)
Now this is really strange and possibly a bug? I have a ChartPanel with a JFReeChart attached and 7 TimeSeriesCollection datasets, each with its own renderer (as explained in question 1 also). As you know, JFReeChart automatically assign a new color to each TimeSeriesCollection dataset line (renderer).
First I compile and run the chart without using the chart.removeLegend() function. Each of the 7 dataset lines has their own nice colors. When I then just add one line of code, the chart.removeLegend() code as shown below, compile and run, the 7 dataset lines gets another set of colors, not the same as before. Why is this? It's very annoying for me for certain reasons. I can get around it by creating a button that when clicked calls chart.RemoveLegend(). But I don't want to have to click a button, I want to remove the legend before everythign is renderer and setVisible on the screen but still have the same colors on the lines as when showing the legend.
Code: Select all
JFreeChart chart = new JFreeChart(plot);
chart.removeLegend();
setChart(chart);
