Examples of PlotModel


Examples of ca.nanometrics.gflot.client.PlotModel

  private static final String[] MONTH_NAMES = { "jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct",
      "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 "";
      }
    }));

    // create a series
    SeriesHandler handler = model.addSeries("Ottawa's Month Temperatures (Daily Average in &deg;C)", "blue");

    // add data
    handler.add(new DataPoint(1, -10.5));
    handler.add(new DataPoint(2, -8.6));
    handler.add(new DataPoint(3, -2.4));
View Full Code Here

Examples of ca.nanometrics.gflot.client.PlotModel

    return "PlotHoverListener";
  }

  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");

    // add data
    handler.add(new DataPoint(1, -10.5));
    handler.add(new DataPoint(2, -8.6));
    handler.add(new DataPoint(3, -2.4));
View Full Code Here

Examples of ca.nanometrics.gflot.client.PlotModel

    return "PlotWithInteractiveLegend";
  }

  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)];
      }
    }));

    // create a series
    // Note: you need to specified the colors in other for the legend to
    // work properly
    SeriesHandler ottawaSeries = model.addSeries("Ottawa", "#edc240");
    SeriesHandler vancouverSeries = model.addSeries("Vancouver", "#afd8f8");

    // add data
    ottawaSeries.add(new DataPoint(1, -10.5));
    ottawaSeries.add(new DataPoint(2, -8.6));
    ottawaSeries.add(new DataPoint(3, -2.4));
View Full Code Here

Examples of ca.nanometrics.gflot.client.PlotModel

    return "SimplePlot";
  }

  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)];
      }
    }));

    // create a series
    SeriesHandler handler = model.addSeries("Ottawa's Month Temperatures (Daily Average in &deg;C)", "blue");

    // add data
    handler.add(new DataPoint(1, -10.5));
    handler.add(new DataPoint(2, -8.6));
    handler.add(new DataPoint(3, -2.4));
View Full Code Here

Examples of ca.nanometrics.gflot.client.PlotModel

    private static final String[] MONTH_NAMES = { "jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "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.setGlobalSeriesOptions( new GlobalSeriesOptions().setBarsSeriesOptions( 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 "";
            }
        } ) );

        // create a series
        SeriesHandler handler = model.addSeries( "Ottawa's Month Temperatures (Daily Average in &deg;C)", "blue" );

        // add data
        handler.add( new DataPoint( 1, -10.5 ) );
        handler.add( new DataPoint( 2, -8.6 ) );
        handler.add( new DataPoint( 3, -2.4 ) );
View Full Code Here

Examples of ca.nanometrics.gflot.client.PlotModel

        return "Image";
    }

    public Widget createExample()
    {
        final PlotModel model = new PlotModel();
        final PlotOptions plotOptions = new PlotOptions();

        // add tick formatter to the options
        plotOptions.setXAxisOptions( new AxisOptions().setMinimum( -8 ).setMaximum( 4 ) );
        plotOptions.setYAxisOptions( new AxisOptions().setMinimum( -8 ).setMaximum( 4 ) );

        // create a series
        SeriesHandler handlerImage = model.addSeries( "Image series" );
        handlerImage.getSeries().setSeriesOptions( SeriesType.IMAGE, new ImageSeriesOptions().setShow( true ).setAlpha(0.5) );
        handlerImage.add( new ImageDataPoint( "images/hs-2004-27-a-large_web.jpg", -2, -2, 2, 2 ) );

        // create a series
        SeriesHandler handlerLine = model.addSeries( "Line series" );
        handlerLine.add( new DataPoint(-8, -8) );
        handlerLine.add( new DataPoint(-6, -4) );
        handlerLine.add( new DataPoint(-2, -8) );
        handlerLine.add( new DataPoint(4, 0) );
View Full Code Here

Examples of ca.nanometrics.gflot.client.PlotModel

    return "PlotHoverListener";
  }

  public Widget createExample() {

    PlotModel model = new PlotModel();
    PlotOptions plotOptions = new PlotOptions();
    plotOptions.setGlobalSeriesOptions( new GlobalSeriesOptions()
        .setLineSeriesOptions( new LineSeriesOptions().setLineWidth( 1 ).setShow( true ) )
        .setPointsOptions( new PointsSeriesOptions().setRadius( 2 ).setShow( true ) ).setShadowSize( 0d ) );
    // 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");

    // add data
    handler.add(new DataPoint(1, -10.5));
    handler.add(new DataPoint(2, -8.6));
    handler.add(new DataPoint(3, -2.4));
View Full Code Here

Examples of ca.nanometrics.gflot.client.PlotModel

    @SuppressWarnings( "deprecation" )
    public Widget createExample()
    {

        PlotModel model = new PlotModel( PlotModelStrategy.defaultStrategy() );
        PlotOptions plotOptions = new PlotOptions();
        plotOptions.setGlobalSeriesOptions( new GlobalSeriesOptions()
        .setLineSeriesOptions( new LineSeriesOptions().setLineWidth( 1 ).setShow( true ) )
        .setPointsOptions( new PointsSeriesOptions().setRadius( 3 ).setShow( true ).setSymbol( PointSymbol.DIAMOND ) ) );
        plotOptions.setLegendOptions( new LegendOptions().setShow( false ) );

        // add tick formatter to the options
        plotOptions.setXAxisOptions( new TimeSeriesAxisOptions().setTickSize( 2, TickTimeUnit.MONTH ).setMonthNames( MONTH_NAMES ) );

        // create a series
        // Note: you need to specified the colors in other for the legend to
        // work properly
        SeriesHandler ottawaSeries = model.addSeries( "Ottawa", "#edc240" );
        SeriesHandler vancouverSeries = model.addSeries( "Vancouver", "#afd8f8" );

        // add data
        ottawaSeries.add( new DataPoint( Date.UTC( 110, 0, 1, 0, 0, 0 ), -10.5 ) );
        ottawaSeries.add( new DataPoint( Date.UTC( 110, 1, 1, 0, 0, 0 ), -8.6 ) );
        ottawaSeries.add( new DataPoint( Date.UTC( 110, 2, 1, 0, 0, 0 ), -2.4 ) );
View Full Code Here

Examples of ca.nanometrics.gflot.client.PlotModel

    }

    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 )];
            }
        } ) );

        plotOptions.setGridOptions( new GridOptions().setAboveData( true ) );

        // create a series
        SeriesHandler handler = model.addSeries( "Ottawa's Month Temperatures (Daily Average in &deg;C)", "blue" );

        // add data
        handler.add( new DataPoint( 1, -10.5 ) );
        handler.add( new DataPoint( 2, -8.6 ) );
        handler.add( new DataPoint( 3, -2.4 ) );
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.