Examples of TickFormatter


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

    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

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

    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

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

    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)];
      }
    }));
View Full Code Here

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

    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

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

        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 )
                {
View Full Code Here

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

        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

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

    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)];
      }
    }));
View Full Code Here

Examples of org.timepedia.chronoscope.client.render.domain.TickFormatter

    // drawHorizontalLine(layer, bounds);

    // TODO: cache this based on domainWidth(?)
    // shouldn't change in the case where the user is just scrolling left/right.
    final double domainWidth = plot.getDomain().length();
    TickFormatter tickFormatter = getBestFormatter(domainWidth);

    //log("best formatter for domain " + (long)domainWidth + ": " + tickFormatter);

    final double labelWidth = tickFormatter.getMaxTickLabelWidth(layer, gssProperties);
    final double labelWidthDiv2 = labelWidth / 2.0;
    final int maxTicksForScreen = calcMaxTicksForScreen(layer, bounds,
        domainWidth, tickFormatter);
    final int idealTickStep = tickFormatter
        .calcIdealTickStep(domainWidth, maxTicksForScreen);
    //log("dw=" + (long)domainWidth + "; maxTicks=" + maxTicksForScreen +
    //    "; idealStep=" + idealTickStep);
   
    tickFormatter
        .resetToQuantizedTick(plot.getDomain().getStart(), idealTickStep);

    boolean stillEnoughSpace = true; // enough space to draw another tick+label?
    boolean isFirstTick = true;
    firstTickX = bounds.width;
    lastTickX = -1;
    double prevTickScreenPos = 0.0;
    int actualTickStep = 0;

//    log("idealTickStep=" + idealTickStep +
//        "; maxTicks=" + maxTicksForScreen +
//        "; domainStart=" + (long)plot.getDomain().getStart() +
//        "; domainLen=" + (long)plot.getDomain().length() +
//        "; quantizedDomainValue=" + (long)tickFormatter.getTickDomainValue() +
//        "; idealTickStep=" + idealTickStep
//        );

    while (stillEnoughSpace) {
      double tickScreenPos = this.domainToScreenX(tickFormatter.getTickDomainValue(), bounds);
      stillEnoughSpace = tickScreenPos + labelWidthDiv2 < bounds.width;
     
//      log("tickScreenPos=" + tickScreenPos +
//          "; tickDomainValue=" + (long)tickFormatter.getTickDomainValue() +
//          "; boundsRightX=" + boundsRightX);

      if ((tickScreenPos > 0) && stillEnoughSpace) {
        // Quantized tick date may have gone off the left edge; need to guard
        // against this case.
        // if (tickScreenPos >= bounds.x) {
          String tickLabel = tickFormatter.format();
          boolean bold = tickFormatter.isBoundary(idealTickStep);
          drawTick(layer, plot, bounds, tickScreenPos, TICK_HEIGHT, bold);
          drawTickLabel(layer, bounds, tickScreenPos, tickLabel, bold, labelWidth);
        // }
      }

      // Draw auxiliary sub-ticks
      if (!isFirstTick) {
        int subTickStep = tickFormatter.getSubTickStep(actualTickStep);
        if (subTickStep > 1) {
          double auxTickWidth = (tickScreenPos - prevTickScreenPos)
              / subTickStep;
          double auxTickPos = prevTickScreenPos + auxTickWidth;
          for (int i = 0; i < subTickStep - 1; i++) {
            // if (MathUtil.isBounded(auxTickPos, bounds.x, boundsRightX)) {
            if (MathUtil.isBounded(auxTickPos, 0, bounds.width)) {
              drawTick(layer, plot, bounds, auxTickPos, SUB_TICK_HEIGHT, false);
            }
            auxTickPos += auxTickWidth;
          }
        }
      }

      actualTickStep = tickFormatter.incrementTick(idealTickStep);
      prevTickScreenPos = tickScreenPos;
      isFirstTick = false;
    }

    if (labelProperties.visible) {
View Full Code Here

Examples of org.timepedia.chronoscope.client.render.domain.TickFormatter

    return tickFormatterFactory.findBestFormatter(domainWidth);
  }

  public double getMinimumTickSize() {
    if (minTickSize == -1) {
      TickFormatter leafFormatter = tickFormatterFactory.getLeafFormatter();
      minTickSize = leafFormatter.getTickInterval();
    }
    return minTickSize;
  }
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.