CombinedXYPlot bugs

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
grzegorz.majer
Posts: 8
Joined: Tue Jul 08, 2003 11:33 am
Location: Poland

CombinedXYPlot bugs

Post by grzegorz.majer » Tue Jul 29, 2003 6:55 pm

Hi,
Bug 707395 (setHorizontalAxisTrace() in CombinedXYPlot) - I solved this problem but maybe this is not the best solution.
In method draw(Graphics2D g2, Rectangle2D plotArea, ChartRenderingInfo info), after this code:

Code: Select all

        if (info != null) {
            info.setDataArea(dataArea);
        }
        // draw all the charts
        for (int i = 0; i < this.subplots.size(); i++) {
            XYPlot plot = (XYPlot) subplots.get(i);
            plot.draw(g2, this.subplotAreas[i], info);
        }
you have to add this code:

Code: Select all

        if (info != null) {
            info.setDataArea(dataArea);
        }
I’m sure that this works with CombinedDomainCategoryPlot and CombinedDomainXYPlot.

But I found another problem connected with drawing secondary axis on CombinedDomainXYPlot. The axis is invisible.
Code which presents this error (based on CombinedXYPlotDemo1).

Code: Select all

 private JFreeChart createCombinedChart() {

        // create subplot 1...
        XYDataset data1 = createDataset1();
        XYItemRenderer renderer1 = new StandardXYItemRenderer();
        NumberAxis rangeAxis1 = new NumberAxis("Range 1");
        XYPlot subplot1 = new XYPlot(data1, null, rangeAxis1, renderer1);
        subplot1.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);

        // add secondary axis
        subplot1.setSecondaryDataset(0, createDataset2());
        NumberAxis axis2 = new NumberAxis("Range Axis 2");
        axis2.setAutoRangeIncludesZero(false);
        subplot1.setSecondaryRangeAxis(0, axis2);
        subplot1.setSecondaryRangeAxisLocation(0, AxisLocation.BOTTOM_OR_RIGHT);
        subplot1.setSecondaryRenderer(0, new StandardXYItemRenderer());
        // the end

        XYTextAnnotation annotation = new XYTextAnnotation("Hello!", 50.0, 10000.0);:
        (...)
    }
When I add method:

Code: Select all

plot.setInsets(new Insets(0,0,0,50));
then this axis is visible but the labels are on the axis.

Best Regards
Grzegorz

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

Post by david.gilbert » Tue Jul 29, 2003 9:27 pm

Thanks for the report. I've added this to the bug database at SourceForge so it doesn't get lost. ID = 779836.
David Gilbert
JFreeChart Project Leader

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

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

Post by david.gilbert » Mon Aug 04, 2003 3:18 pm

Fixed for the 0.9.11 release (end of this week).
David Gilbert
JFreeChart Project Leader

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

Locked