Package ca.nanometrics.gflot.client.options

Examples of ca.nanometrics.gflot.client.options.PlotOptions


  }

  public Widget createExample() {

    PlotModel model = new PlotModel();
    PlotOptions plotOptions = new PlotOptions();

    // add tick formatter to the options
    plotOptions.setXAxisOptions(new AxisOptions().setTicks(12).setTickFormatter(new TickFormatter() {
      public String formatTickValue(double tickValue, Axis axis) {
        return MONTH_NAMES[(int) (tickValue - 1)];
      }
    }));
View Full Code Here


  public Widget createExample() {
   
    final Label selectedPointLabel = new Label(INSTRUCTION);

    PlotWithOverviewModel model = new PlotWithOverviewModel(PlotModelStrategy.defaultStrategy());
    PlotOptions plotOptions = new PlotOptions();
    plotOptions.setDefaultLineSeriesOptions(new LineSeriesOptions().setLineWidth(1).setShow(true));
    plotOptions.setDefaultPointsOptions(new PointsSeriesOptions().setRadius(2).setShow(true));
    plotOptions.setDefaultShadowSize(1);

    plotOptions.setLegendOptions(new LegendOptions().setShow(false));

    plotOptions.setSelectionOptions(new SelectionOptions().setDragging(true).setMode("x"));
    final PlotWithOverview plot = new PlotWithOverview(model, plotOptions);
    // add hover listener
    plot.addHoverListener(new PlotHoverListener() {
      public void onPlotHover(Plot plot, PlotPosition position, PlotItem item) {
        if (item != null) {
          selectedPointLabel
              .setText("x: " + item.getDataPoint().getX() + ", y: " + item.getDataPoint().getY());
        } else {
          selectedPointLabel.setText(INSTRUCTION);
        }
      }
    }, false);
    plot.addSelectionListener(new SelectionListener() {

      public void selected(double x1, double y1, double x2, double y2) {
        plot.setLinearSelection(x1, x2);
      }
    });
    SeriesHandler s = plot.getModel().addSeries("Series 1");
    s.add(new DataPoint(1, 2));
    s.add(new DataPoint(2, 5));
    s.add(new DataPoint(3, 7));
    s.add(new DataPoint(4, 5));
    s.add(new DataPoint(5, 3));
    s.add(new DataPoint(6, 2));
    s.add(new DataPoint(7, 5));
    s.add(new DataPoint(8, 7));
    s.add(new DataPoint(9, 5));
    s.add(new DataPoint(10, 3));

    // Start of Marking Code
    Marking m = new Marking();
    m.setX(new Range(2, 4));
    m.setColor("#3BEFc3");

    Marking m2 = new Marking();
    m2.setX(new Range(5, 7));
    m2.setColor("#cccccc");

    Marking m3 = new Marking();
    Range a = new Range();
    a.setFrom(8);
    m3.setX(a);
    m3.setColor("#000000");

    Markings ms = new Markings();
    ms.addMarking(m);
    ms.addMarking(m2);
    ms.addMarking(m3);
    // End of Marking Code

    // Add Markings Objects to Grid Options
    plotOptions.setGridOptions(new GridOptions().setHoverable(true).setMarkings(ms));

    plot.setHeight(250);
    plot.setOverviewHeight(60);

   
View Full Code Here

  private double previous = 0;
  private int timeCounter = 0;

  public Widget createExample() {
    PlotWithOverviewModel model = new PlotWithOverviewModel(PlotModelStrategy.downSamplingStrategy(20));
    PlotOptions plotOptions = new PlotOptions();
    plotOptions.setDefaultLineSeriesOptions(new LineSeriesOptions().setLineWidth(1).setShow(true));
    plotOptions.setDefaultPointsOptions(new PointsSeriesOptions().setRadius(2).setShow(true));
    plotOptions.setDefaultShadowSize(0);

    final SeriesHandler series = model.addSeries("Random Series", "#003366");

    // create the plot
    final PlotWithOverview plot = new PlotWithOverview(model, plotOptions);
View Full Code Here

      "nov", "dec" };

  public Widget createExample() {

    PlotModel model = new PlotModel();
    PlotOptions plotOptions = new PlotOptions();

    BarSeriesOptions barSeriesOptions = new BarSeriesOptions();
    barSeriesOptions.setShow(true);
    barSeriesOptions.setLineWidth(1);
    barSeriesOptions.setBarWidth(1);
    barSeriesOptions.setAlignment(BarAlignment.CENTER);

    plotOptions.setDefaultBarsSeriesOptions(barSeriesOptions);
    plotOptions.setLegendOptions(new LegendOptions().setShow(false));

    // add tick formatter to the options
    plotOptions.setXAxisOptions(new AxisOptions().setTicks(12).setTickFormatter(new TickFormatter() {
      public String formatTickValue(double tickValue, Axis axis) {
        if (tickValue > 0 && tickValue <= 12) {
          return MONTH_NAMES[(int) (tickValue - 1)];
        }
        return "";
View Full Code Here

*/
public class SlidingWindowExample implements GFlotExample {

  public Widget createExample() {
    PlotWithOverviewModel model = new PlotWithOverviewModel(PlotModelStrategy.slidingWindowStrategy(20));
    PlotOptions plotOptions = new PlotOptions();
    plotOptions.setDefaultLineSeriesOptions(new LineSeriesOptions().setLineWidth(1).setShow(true));
    plotOptions.setDefaultPointsOptions(new PointsSeriesOptions().setRadius(2).setShow(true));
    plotOptions.setDefaultShadowSize(0);
    plotOptions.setXAxisOptions(new TimeSeriesAxisOptions());

    PlotOptions overviewPlotOptions = new PlotOptions().setDefaultShadowSize(0).setLegendOptions(
        new LegendOptions().setShow(false)).setDefaultLineSeriesOptions(
        new LineSeriesOptions().setLineWidth(1).setFill(true)).setSelectionOptions(
        new SelectionOptions().setMode(SelectionOptions.X_SELECTION_MODE).setDragging(true)).setXAxisOptions(
        new TimeSeriesAxisOptions());

View Full Code Here

   * @see ca.nanometrics.gflot.client.example.GFlotExample#createExample()
   */
  public Widget createExample() {

    PlotWithOverviewModel model = new PlotWithOverviewModel(PlotModelStrategy.defaultStrategy());
    PlotOptions plotOptions = new PlotOptions();
    plotOptions.setDefaultLineSeriesOptions(new LineSeriesOptions().setLineWidth(1).setShow(true));
    plotOptions.setDefaultPointsOptions(new PointsSeriesOptions().setRadius(2).setShow(true));
    plotOptions.setDefaultShadowSize(0);

    SeriesHandler series = model.addSeries("Random Series", "#2c1d54");

    // generate random data
    for (int i = 0; i < 200; i++) {
View Full Code Here

  }

  public Widget createExample() {

    PlotModel model = new PlotModel();
    PlotOptions plotOptions = new PlotOptions();
    plotOptions.setDefaultLineSeriesOptions(new LineSeriesOptions().setLineWidth(1).setShow(true));
    plotOptions.setDefaultPointsOptions(new PointsSeriesOptions().setRadius(2).setShow(true));
    plotOptions.setDefaultShadowSize(0);

    // add tick formatter to the options
    plotOptions.setXAxisOptions(new AxisOptions().setTicks(12).setTickFormatter(new TickFormatter() {
      public String formatTickValue(double tickValue, Axis axis) {
        return MONTH_NAMES[(int) (tickValue - 1)];
      }
    }));

    // >>>>>>> You need make the grid hoverable <<<<<<<<<
    plotOptions.setGridOptions(new GridOptions().setHoverable(true));
    // >>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

    // create a series
    SeriesHandler handler = model.addSeries("Ottawa's Month Temperatures (Daily Average in &deg;C)", "#007f00");
View Full Code Here

  }

  public Widget createExample() {

    PlotModel model = new PlotModel(PlotModelStrategy.defaultStrategy());
    PlotOptions plotOptions = new PlotOptions();
    plotOptions.setDefaultLineSeriesOptions(new LineSeriesOptions().setLineWidth(1).setShow(true));
    plotOptions.setDefaultPointsOptions(new PointsSeriesOptions().setRadius(2).setShow(true));
    plotOptions.setDefaultShadowSize(0);
    plotOptions.setLegendOptions(new LegendOptions().setShow(false));

    // add tick formatter to the options
    plotOptions.setXAxisOptions(new AxisOptions().setTicks(12).setTickFormatter(new TickFormatter() {
      public String formatTickValue(double tickValue, Axis axis) {
        return MONTH_NAMES[(int) (tickValue - 1)];
      }
    }));
View Full Code Here

  private final PlotWithOverviewModel m_model;
  private boolean m_ignoreSelectionEvent;

  public PlotWithOverview(PlotWithOverviewModel model) {
    this(model, new PlotOptions());
  }
View Full Code Here

        return PlotImpl.getPlotOffsetBottom( this );
    }

    public final PlotOptions getPlotOptions()
    {
        return new PlotOptions( new JSONObject( PlotImpl.getPlotOptions( this ) ) );
    }
View Full Code Here

TOP

Related Classes of ca.nanometrics.gflot.client.options.PlotOptions

Copyright © 2018 www.massapicom. 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.