Pb with url generator on pie chart

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
akkeri
Posts: 13
Joined: Sat Nov 22, 2003 10:50 pm

Pb with url generator on pie chart

Post by akkeri » Tue Jan 06, 2004 4:59 pm

i am generating two kinds of charts: bar an pie charts
i am having pbs when generating urls for pie charts, i used:
for bar charts

Code: Select all

renderer.setItemURLGenerator(new StandardCategoryURLGenerator("chart.jsp", "series", "section"));
and it worked fine. and for pie charts i used:

Code: Select all

plot.setURLGenerator(new StandardPieURLGenerator("chart.jsp","section"));
but the url generated is not chart.jsp?section=some_value is was index.html?section=some_value how can i solve this pb. thanks

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 Jan 06, 2004 10:15 pm

I added the following JUnit test to the CVS code, and it passes:

Code: Select all

    /**
     * Test that the generated URL is as expected.
     */
    public void testURL() {
        DefaultPieDataset dataset = new DefaultPieDataset();
        dataset.setValue("Alpha", new Double(5.0));
        dataset.setValue("Beta", new Double(5.5));
        StandardPieURLGenerator g1 = new StandardPieURLGenerator("chart.jsp", "category");
        String url = g1.generateURL(dataset, "Beta", 0);
        assertEquals("chart.jsp?category=Beta", url);
    }
Can you run the test with the version of JFreeChart that you are using?
David Gilbert
JFreeChart Project Leader

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

akkeri
Posts: 13
Joined: Sat Nov 22, 2003 10:50 pm

Post by akkeri » Wed Jan 07, 2004 10:31 am

thanks dave but i solved the pb.
first i used the code provided by Richard Atkinson in it home page :

Code: Select all

Pie3DPlot  plot = new Pie3DPlot(data);
plot.setURLGenerator(new StandardPieURLGenerator("chart.jsp","section"));
and i had the pb
but then i change it to

Code: Select all

chart = ChartFactory.createPie3DChart("title", data, true, true, true);
PiePlot pieplot = (PiePlot)chart.getPlot();
pieplot.setURLGenerator(new StandardPieURLGenerator("chart.jsp","section"));
and it worked fine thanks

Locked