Examples of XYPlot


Examples of org.jfree.chart.plot.XYPlot

    this(chart,0,0,400,300);
  }

  public AreaPlotShape(JFreeChart chart, int ox, int oy, int width, int height) {
    super(chart, ox, oy, width, height);
    XYPlot plot = (XYPlot)chart.getXYPlot();
    plot.setRenderer(new JSynopticAreaXYItemRenderer());
    plot.setForegroundAlpha(0.7f);
  }
View Full Code Here

Examples of org.jfree.chart.plot.XYPlot

    }

    Vector v = new Vector();
    v.add(resources.getString("Properties..."));

    XYPlot plot = (XYPlot)chart.getXYPlot();
    SourceXYDataset dst = (SourceXYDataset)plot.getDataset();

    if (o instanceof DataSource) {
      v.add(resources.getString("setX"));
      if (dst.getSources().size() != 0) {
        v.add(resources.getString("addY"));
View Full Code Here

Examples of org.jfree.chart.plot.XYPlot

    if (action.equals(resources.getString("Properties..."))) {
      new LongAction(LongAction.LONG_ACTION_SHAPE, null, this) {
        protected void doAction() {
          ChartPropertyEditPanel panel = new ChartPropertyEditPanel(chart);
          JTabbedPane tab = findTab(panel);
          XYPlot plot = (XYPlot)chart.getXYPlot();
          PlotPanel plotPanel = new PlotPanel();
          Container c = (Container)plotPanel.getComponent(0);
          Box b = Box.createHorizontalBox();
          b.add(new JLabel(resources.getString("TransparencyCoefficient")));
          NumberField nfalpha;
          b.add(Box.createHorizontalGlue());
          b.add(nfalpha = new NumberField(plot.getForegroundAlpha()));
          c.add(b);
          b = Box.createHorizontalBox();
          JCheckBox cbDrawContour;
          b.add(cbDrawContour = new JCheckBox(resources.getString("OutlineEachSegment"), ((JSynopticAreaXYItemRenderer)plot.getRenderer()).isOutline()));
          b.add(Box.createHorizontalGlue());
          c.add(b);
          if (tab!=null) tab.add(plotPanel,0);
          int result = JOptionPane.showConfirmDialog(null, panel,
            resources.getString("ChartProperties"), JOptionPane.OK_CANCEL_OPTION,
            JOptionPane.PLAIN_MESSAGE);
          if (result == JOptionPane.OK_OPTION) {
            panel.updateChartProperties(chart);
            if (plotPanel!=null) {
              plotPanel.updateChartProperties();
              plot.setForegroundAlpha((float)nfalpha.getDoubleValue());
              ((JSynopticAreaXYItemRenderer)plot.getRenderer()).setOutline(cbDrawContour.isSelected());
            }
          }
          notifyChange();
        }
      }.start();
View Full Code Here

Examples of org.jfree.chart.plot.XYPlot

    this(chart,0,0,400,300);
  }

  public StandardPlotShape(JFreeChart chart, int ox, int oy, int width, int height) {
    super(chart, ox, oy, width, height);
    XYPlot plot = chart.getXYPlot();
    NumberAxis axis = new NumberAxis();
    //CyclicNumberAxis axis = new CyclicNumberAxis(0, 100);
    plot.setDomainAxis(axis);
    axis.setAutoRange(true);
    //axis.setAutoRangeIncludesZero(false);
    ValueAxis vaxis = plot.getRangeAxis();
    axis.setAutoRange(true);
    if (vaxis instanceof NumberAxis) {((NumberAxis)vaxis).setAutoRangeIncludesZero(false);}
    plot.setRenderer(new JSynopticStandardXYItemRenderer());
    //plot.setRenderer(new CyclicXYItemRenderer());
    plot.setRangeCrosshairLockedOnData(false);
    plot.setDomainCrosshairLockedOnData(false);
  }
View Full Code Here

Examples of org.jfree.chart.plot.XYPlot

    }

    Vector v = new Vector();
    v.add(resources.getString("Properties..."));

    XYPlot plot = (XYPlot)chart.getXYPlot();
    SourceXYDataset dst = (SourceXYDataset)plot.getDataset();
    SourceXYDataset dst2 = (SourceXYDataset)plot.getSecondaryDataset(0);

    if (o instanceof DataSource) {
      v.add(resources.getString("setX"));
      if (dst.getSources().size() != 0) {
        v.add(resources.getString("addY"));
        v.add(resources.getString("setSecX"));
        plot.getSecondaryDatasetCount();
        if (dst2!=null && dst2.getSources().size() != 0)
          v.add(resources.getString("addSecY"));
      }
    }
   
    else if (o instanceof DataSourceCollection) {
      v.add(resources.getString("setXY1Yn"));
      if (dst.getSources().size() != 0) {
        v.add(resources.getString("addY1Yn"));
        v.add(resources.getString("setSecXY1Yn"));
        plot.getSecondaryDatasetCount();
        if (dst2!=null && dst2.getSources().size() != 0)
          v.add(resources.getString("addSecY1Yn"));
      }
    }
View Full Code Here

Examples of org.jfree.chart.plot.XYPlot

   */
  public boolean doAction(double x, double y, Object o, String action, CompoundEdit undoableEdit) {
    if (action.equals("mouseover")) {
      if (chartRenderingInfo==null) return false;

      XYPlot plot = (XYPlot)chart.getXYPlot();
     
      PlotRenderingInfo info = chartRenderingInfo.getPlotInfo();
      Rectangle2D dataArea = info.getDataArea();
      if (dataArea.contains(x, y)) {
        plot.setRangeCrosshairVisible(true);
        plot.setDomainCrosshairVisible(true);
       
        String msg = "";

        // set the crosshair value for the horizontal axis...
        ValueAxis da = plot.getDomainAxis();
        if (da != null) {
          double hvalue = da.translateJava2DToValue(x, info.getDataArea(),plot.getDomainAxisEdge());
          plot.setDomainCrosshairValue(hvalue,false);
          String label = da.getLabel();
          if ((label!=null) && (!label.equals(""))) msg += label;
          else msg+= resources.getString("X");
          msg += "=" + AxisLabelFormatter.labelFormat(hvalue);
        }

        // set the crosshair value for the vertical axis...
        ValueAxis ra = plot.getRangeAxis();
        if (ra != null) {
          double vvalue = ra.translateJava2DToValue(y, info.getDataArea(),plot.getRangeAxisEdge());
          plot.setRangeCrosshairValue(vvalue,false);
          if (!msg.equals("")) msg+="   ";
          String label = ra.getLabel();
          if ((label!=null) && (!label.equals(""))) msg += label;
          else msg+= resources.getString("Y");
          msg += "=" + AxisLabelFormatter.labelFormat(vvalue);
        }
        notifyChange(dataArea.getBounds());
        if (!msg.equals("")) JSynoptic.setStatus(msg);
      } else {
        plot.setRangeCrosshairVisible(false);
        plot.setDomainCrosshairVisible(false);
      }
     
    }

    if (action.equals("mouseout")) {
      XYPlot plot = (XYPlot)chart.getXYPlot();
      plot.setRangeCrosshairVisible(false);
      plot.setDomainCrosshairVisible(false);
      JSynoptic.setStatus("");
    }
   
    if (action.equals(resources.getString("Properties..."))) {
      new LongAction(LongAction.LONG_ACTION_SHAPE, null, this) {
        protected void doAction() {
          ChartPropertyEditPanel panel = new ChartPropertyEditPanel(chart);
          JTabbedPane tab = findTab(panel);
          PlotPanel plotPanel = null;
          if (tab!=null) tab.add(plotPanel = new PlotPanel(),0);
          int result = JOptionPane.showConfirmDialog(null, panel,
            resources.getString("ChartProperties"), JOptionPane.OK_CANCEL_OPTION,
            JOptionPane.PLAIN_MESSAGE);
          if (result == JOptionPane.OK_OPTION) {
            panel.updateChartProperties(chart);
            if (plotPanel!=null) plotPanel.updateChartProperties();
          }
          notifyChange();
        }
      }.start();
      return true;
    }

    //for DataSource Collection ----> dirty duplication...
    if (action.equals(resources.getString("setXY1Yn"))) {
      try {
        XYPlot plot = chart.getXYPlot();
        SourceXYDataset dst = (SourceXYDataset)plot.getDataset();
        dst.setDataSourceCollection((DataSourceCollection)o);
        chart.setTitle(dst.getName());
        plot.getDomainAxis().setLabel(dst.getXLabel(0));
        notifyChange();
      } catch (ClassCastException cce) {
        JSynoptic.setStatus(resources.getString("ErrorWhileSettingDataSourceCollection"));
      }
    }

    if (action.equals(resources.getString("addY1Yn"))) {
      try {
        XYPlot plot = chart.getXYPlot();
        SourceXYDataset dst = (SourceXYDataset)plot.getDataset();
        dst.addDataSourceCollection((DataSourceCollection)o);
        notifyChange();
      } catch (ClassCastException cce) {
        JSynoptic.setStatus(resources.getString("ErrorWhileSettingDataSourceCollection"));
      }
    }

    if (action.equals(resources.getString("setSecXY1Yn"))) {
      try {
        XYPlot plot = chart.getXYPlot();
        SourceXYDataset dst2 = (SourceXYDataset)plot.getSecondaryDataset(0);
        //If not any previous Secondary Dataset was found
        if (dst2==null) {
          //we build a new one
          dst2 = new SourceXYDataset();
          //and link it
          plot.setSecondaryDataset(0,dst2);
        }
        dst2.setDataSourceCollection((DataSourceCollection)o);
        //If we got no secondary domain axis
        if (plot.getSecondaryDomainAxis(0)==null) {
          //we build a new one
          NumberAxis axis = new NumberAxis();
          axis.setAutoRange(true);
          //and link it
          plot.setSecondaryDomainAxis(0,axis);
        }
        //If we got no secondary range axis
        if (plot.getSecondaryRangeAxis(0)==null) {
          //We build a new one
          NumberAxis axis = new NumberAxis();
          axis.setAutoRange(true);
          //and link it
          plot.setSecondaryRangeAxis(0,axis);
        }
        //We reset the title
        chart.setTitle(chart.getTitle().getText() + " and " + dst2.getName());
        //We set Xlabel
        plot.getSecondaryDomainAxis(0).setLabel(dst2.getXLabel(0));
        //If necessary we set the renderer
        if (plot.getSecondaryRenderer(0)==null) {
          plot.setSecondaryRenderer(0,new JSynopticStandardXYItemRenderer(2));
        }
        //We map the secondary dataset to secondary domain axis
        plot.mapSecondaryDatasetToDomainAxis(0,new Integer(0));
        //We map the secondary dataset to secondary range axis
        plot.mapSecondaryDatasetToRangeAxis(0,new Integer(0));
        notifyChange();
      } catch (ClassCastException cce) {
        JSynoptic.setStatus(resources.getString("ErrorWhileSettingXDataSource"));
     
    }
   
    if (action.equals(resources.getString("addSecY1Yn"))) {
      try {
        XYPlot plot = chart.getXYPlot();
        SourceXYDataset dst2 = (SourceXYDataset)plot.getSecondaryDataset(0);
        dst2.addYSource((DataSource)o);
        //If we got no secondary range axis
        if (plot.getSecondaryRangeAxis(0)==null) {
          //We build a new one
          NumberAxis axis = new NumberAxis();
          axis.setAutoRange(true);
          //and link it
          plot.setSecondaryRangeAxis(0,axis);
        }
        //We map the secondary dataset to secondary range axis
        plot.mapSecondaryDatasetToRangeAxis(0,new Integer(0));
        notifyChange();
      } catch (ClassCastException cce) {
        JSynoptic.setStatus(resources.getString("ErrorWhileAddingYDataSource"));
      }
    }
   
    //for DataSource ----> dirty duplication...
    if (action.equals(resources.getString("setX"))) {
      try {
        XYPlot plot = chart.getXYPlot();
        SourceXYDataset dst = (SourceXYDataset)plot.getDataset();
        dst.setXSource((DataSource)o);
        plot.getDomainAxis().setLabel(dst.getXLabel(0));
        notifyChange();
      } catch (ClassCastException cce) {
        JSynoptic.setStatus(resources.getString("ErrorWhileSettingXDataSource"));
      }
    }
   
    if (action.equals(resources.getString("addY"))) {
      try {
        XYPlot plot = chart.getXYPlot();
        SourceXYDataset dst = (SourceXYDataset)plot.getDataset();
        dst.addYSource((DataSource)o);
        notifyChange();
      } catch (ClassCastException cce) {
        JSynoptic.setStatus(resources.getString("ErrorWhileAddingYDataSource"));
      }
    }
 

   
    if (action.equals(resources.getString("setSecX"))) {
      try {
        XYPlot plot = chart.getXYPlot();
        SourceXYDataset dst2 = (SourceXYDataset)plot.getSecondaryDataset(0);
        //If not any previous Secondary Dataset was found
        if (dst2==null) {
          //we build a new one
          dst2 = new SourceXYDataset();
          //and link it
          plot.setSecondaryDataset(0,dst2);
        }
        dst2.setXSource((DataSource)o);
        //If we got no axis
        if (plot.getSecondaryDomainAxis(0)==null) {
          //we build a new one
          NumberAxis axis = new NumberAxis();
          axis.setAutoRange(true);
          //and link it
          plot.setSecondaryDomainAxis(0,axis);
        }
        //We set the label
        plot.getSecondaryDomainAxis(0).setLabel(dst2.getXLabel(0));
        //If necessary we set the renderer
        if (plot.getSecondaryRenderer(0)==null) {
          plot.setSecondaryRenderer(0,new JSynopticStandardXYItemRenderer(2));
        }
        //We map the secondary dataset to secondary domain axis
        plot.mapSecondaryDatasetToDomainAxis(0,new Integer(0));
        notifyChange();
      } catch (ClassCastException cce) {
        JSynoptic.setStatus(resources.getString("ErrorWhileSettingXDataSource"));
      }
    }

    if (action.equals(resources.getString("addSecY"))) {
      try {
        XYPlot plot = chart.getXYPlot();
        SourceXYDataset dst2 = (SourceXYDataset)plot.getSecondaryDataset(0);
        dst2.addYSource((DataSource)o);
        //If we got no axis
        if (plot.getSecondaryRangeAxis(0)==null) {
          //We build a new one
          NumberAxis axis = new NumberAxis();
          axis.setAutoRange(true);
          //and link it
          plot.setSecondaryRangeAxis(0,axis);
        }
        //We map the secondary dataset to secondary range axis
        plot.mapSecondaryDatasetToRangeAxis(0,new Integer(0));
        notifyChange();
      } catch (ClassCastException cce) {
        JSynoptic.setStatus(resources.getString("ErrorWhileAddingYDataSource"));
      }
    }
View Full Code Here

Examples of org.jfree.chart.plot.XYPlot

   
    } else if (name.equals(PLOT_SCATTER)) {
      SourceXYDataset dst = new SourceXYDataset();
      JFreeChart chart = ChartFactory.createScatterPlot("", "", "", dst, PlotOrientation.VERTICAL, true, true, false);
      chart.setAntiAlias(AbstractShape.ANTI_ALIASING);
      XYPlot plot = chart.getXYPlot();
      NumberAxis axis = new NumberAxis();
      plot.setDomainAxis(axis);
      axis.setAutoRange(true);
      axis.setAutoRangeIncludesZero(false);
      ValueAxis vaxis = plot.getRangeAxis();
      axis.setAutoRange(true);
      if (vaxis instanceof NumberAxis) {((NumberAxis)vaxis).setAutoRangeIncludesZero(false);}
      res = new ScatterPlotShape(chart);;
   
    } else if (name.equals(PLOT_PARAMETRIC)) {
      SourceXYDataset dst = new SourceXYDataset();
      JFreeChart chart = ChartFactory.createTimeSeriesChart("", "", "", dst, true, true, false);
      chart.setAntiAlias(AbstractShape.ANTI_ALIASING);
      XYPlot plot = chart.getXYPlot();
      NumberAxis axis = new NumberAxis();
      plot.setDomainAxis(axis);
      axis.setAutoRange(true);
      axis.setAutoRangeIncludesZero(false);
      ValueAxis vaxis = plot.getRangeAxis();
      axis.setAutoRange(true);
      if (vaxis instanceof NumberAxis) {((NumberAxis)vaxis).setAutoRangeIncludesZero(false);}
      res = new ParametricPlotShape(chart);
   
    } else if (name.equals(METER)) {
      SourceMeterDataset dst = new SourceMeterDataset();
      DatasetDelegatedMeterPlot plot = new DatasetDelegatedMeterPlot(dst);
      plot.setDialShape(DialShape.CIRCLE);
      JFreeChart chart = new JFreeChart("", JFreeChart.DEFAULT_TITLE_FONT, plot, false);
      chart.setAntiAlias(AbstractShape.ANTI_ALIASING);
      res = new MeterShape(chart);
   
    } else if (name.equals(BAR_CHART)) {
View Full Code Here

Examples of org.jfree.chart.plot.XYPlot

    this(chart,0,0,400,300);
  }

  public ParametricPlotShape(JFreeChart chart, int ox, int oy, int width, int height) {
    super(chart, ox, oy, width, height);
    XYPlot plot = (XYPlot)chart.getXYPlot();
    SourceXYDataset dst = (SourceXYDataset)plot.getDataset();
    dst.setNameAccordingToYOnly(false);
  }
View Full Code Here

Examples of org.jfree.chart.plot.XYPlot

    }

    Vector v = new Vector();
    v.add(resources.getString("Properties..."));

    XYPlot plot = (XYPlot)chart.getXYPlot();
    SourceXYDataset dst = (SourceXYDataset)plot.getDataset();

    if (o instanceof DataSource) {
      int n = dst.getSources().size();
      v.add (resources.getString("SetAsX1"));
      for (int i=0; i<n; ++i) {
View Full Code Here

Examples of org.jfree.chart.plot.XYPlot

   */
  public boolean doAction(double x, double y, Object o, String action, CompoundEdit undoableEdit) {

    if (action.equals(resources.getString("SetAsCommonX,Y1...Yn"))) {
      try {
        XYPlot plot = chart.getXYPlot();
        SourceXYDataset dst = (SourceXYDataset)plot.getDataset();
        dst.setDataSourceCollection((DataSourceCollection)o);
        chart.setTitle(dst.getName());
        notifyChange();
        return true;
      } catch (ClassCastException cce) {
        JSynoptic.setStatus(resources.getString("ErrorWhileSettingDataSourceCollection"));
        return false;
      }
    }

    if (action.equals(resources.getString("SetAs(X1,Y1)...(Xn,Yn)"))) {
      try {
        XYPlot plot = chart.getXYPlot();
        SourceXYDataset dst = (SourceXYDataset)plot.getDataset();
        dst.setDataSourceCollectionAsCouples((DataSourceCollection)o);
        chart.setTitle(dst.getName());
        notifyChange();
        return true;
      } catch (ClassCastException cce) {
        JSynoptic.setStatus(resources.getString("ErrorWhileSettingDataSourceCollection"));
        return false;
      }
    }

    if (action.startsWith(resources.getString("SetAsX"))) {
      try {
        XYPlot plot = chart.getXYPlot();
        SourceXYDataset dst = (SourceXYDataset)plot.getDataset();
        int i = (int)Long.parseLong(action.substring(action.length()-1));
        dst.setXSource((DataSource)o,i-1);
        notifyChange();
        return true;
      } catch (ClassCastException cce) {
        JSynoptic.setStatus(resources.getString("ErrorWhileSettingXDataSource"));
        return false;
      }
    }

    if (action.startsWith(resources.getString("SetAsY"))) {
      try {
        XYPlot plot = chart.getXYPlot();
        SourceXYDataset dst = (SourceXYDataset)plot.getDataset();
        int i = (int)Long.parseLong(action.substring(action.length()-1));
        dst.setYSource((DataSource)o,i-1);
        notifyChange();
        return true;
      } catch (ClassCastException cce) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.