overlaidchart example

Help
jncamp
2006-09-01
2013-01-13
  • jncamp

    jncamp - 2006-09-01

    assume i can produce in my jsp two charts, chartA and chartB.

    if i want to overlay chartB on chartA, could someone please provide me with a simple code snippet as to how to do this ??

    thanks.

     
    • Zoltan Luspai

      Zoltan Luspai - 2006-09-04

      Hi,

      Have a look at cewolfexample project; that contains examples.
      Zoltan

       
    • jncamp

      jncamp - 2006-09-04

      got that to work using one of the examples. however, the chartpostprocessor tag only seems to work on one of the datasets.

      can you help me to remedy this ???

       
    • Zoltan Luspai

      Zoltan Luspai - 2006-09-04

      The overlaid chart works that the two charts are combined into one chart (JFreeChart) object. The chartpostprocessor is only called for the combined chart, but it can access both charts' renderers to customize how they look.
      Here's an example from the overlay1_inc.jsp page:

      // example how to create a post processor for each charts in the overlaid
              ChartPostProcessor postprocessor = new ChartPostProcessor() {

                  public void processChart(Object chart, Map params) {
                      JFreeChart jfc = (JFreeChart) chart;
                      XYPlot plot = (XYPlot) jfc.getPlot();
                      // set different colors for each:
                      Color[] colors = new Color[] { Color.BLACK, Color.BLUE,
                              Color.YELLOW, Color.GREEN, Color.GRAY };
                      for (int i = 0; i < 4; i++) {
                          XYItemRenderer renderer = plot.getRenderer(i);
                          if (renderer!=null) {
                              renderer.setPaint(colors[i]);
                          }
                      }
                  }

              };

       
    • jncamp

      jncamp - 2006-09-04

      zoltan,

      i may be going about this the wrong way. what i have is a scatter plot with just a few points. i want the the leftmost point and the rightmost point connected by a line, and the innermost points to be unconnected...

       
    • jncamp

      jncamp - 2006-09-05

      zoltan,

      i played with this this weekend and took your advice. that did ALL i needed it to do.

      thank you so much. you are ALWAYS a big help!

       

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks