Package com.positive.charts.axis

Examples of com.positive.charts.axis.ValueAxis


    if (orientation == null) {
      throw new IllegalArgumentException("Null 'orientation' argument.");
    }
    final CategoryAxis categoryAxis = new CategoryAxis(categoryAxisLabel);
    final ValueAxis valueAxis = new NumberAxis(valueAxisLabel);

    final BarRenderer renderer = new BarRenderer();
    if (orientation == PlotOrientation.HORIZONTAL) {
      final ItemLabelPosition position1 = new ItemLabelPosition(
          ItemLabelAnchor.OUTSIDE3, TextAnchor.CENTER_LEFT);
View Full Code Here


  public static Chart createTimeSeriesChart(final String title,
      final String timeAxisLabel, final String valueAxisLabel,
      final XYDataset dataset, final boolean legend,
      final boolean tooltips, final boolean urls) {

    final ValueAxis timeAxis = new DateAxis(timeAxisLabel);
    timeAxis.setLowerMargin(0.02); // reduce the default margins
    timeAxis.setUpperMargin(0.02);
    final NumberAxis valueAxis = new NumberAxis(valueAxisLabel);
    valueAxis.setAutoRangeIncludesZero(false); // override default
    final XYPlot plot = new XYPlot(dataset, timeAxis, valueAxis, null);

    // XYToolTipGenerator toolTipGenerator = null;
View Full Code Here

   * Clears the domain axes from the plot and sends a {@link PlotChangeEvent}
   * to all registered listeners.
   */
  public void clearDomainAxes() {
    for (int i = 0; i < this.domainAxes.size(); i++) {
      final ValueAxis axis = (ValueAxis) this.domainAxes.get(i);
      if (axis != null) {
        axis.removeChangeListener(this);
      }
    }
    this.domainAxes.clear();
    this.notifyListeners(new PlotChangeEvent(this));
  }
View Full Code Here

   * Clears the range axes from the plot and sends a {@link PlotChangeEvent}
   * to all registered listeners.
   */
  public void clearRangeAxes() {
    for (int i = 0; i < this.rangeAxes.size(); i++) {
      final ValueAxis axis = (ValueAxis) this.rangeAxes.get(i);
      if (axis != null) {
        axis.removeChangeListener(this);
      }
    }
    this.rangeAxes.clear();
    this.notifyListeners(new PlotChangeEvent(this));
  }
View Full Code Here

  /**
   * Configures the domain axes.
   */
  public void configureDomainAxes() {
    for (int i = 0; i < this.domainAxes.size(); i++) {
      final ValueAxis axis = (ValueAxis) this.domainAxes.get(i);
      if (axis != null) {
        axis.configure();
      }
    }
  }
View Full Code Here

  /**
   * Configures the range axes.
   */
  public void configureRangeAxes() {
    for (int i = 0; i < this.rangeAxes.size(); i++) {
      final ValueAxis axis = (ValueAxis) this.rangeAxes.get(i);
      if (axis != null) {
        axis.configure();
      }
    }
  }
View Full Code Here

    crosshairState.setAnchor(anchor);

    crosshairState.setAnchorX(Double.NaN);
    crosshairState.setAnchorY(Double.NaN);
    if (anchor != null) {
      final ValueAxis domainAxis = this.getDomainAxis();
      if (domainAxis != null) {
        double x;
        if (orient == PlotOrientation.VERTICAL) {
          x = domainAxis.java2DToValue(anchor.x, dataArea, this
              .getDomainAxisEdge());
        } else {
          x = domainAxis.java2DToValue(anchor.y, dataArea, this
              .getDomainAxisEdge());
        }
        crosshairState.setAnchorX(x);
      }
      final ValueAxis rangeAxis = this.getRangeAxis();
      if (rangeAxis != null) {
        double y;
        if (orient == PlotOrientation.VERTICAL) {
          y = rangeAxis.java2DToValue(anchor.y, dataArea, this
              .getRangeAxisEdge());
        } else {
          y = rangeAxis.java2DToValue(anchor.x, dataArea, this
              .getRangeAxisEdge());
        }
        crosshairState.setAnchorY(y);
      }
    }
View Full Code Here

    final AxisCollection axisCollection = new AxisCollection();

    // add domain axes to lists...
    for (int index = 0; index < this.domainAxes.size(); index++) {
      final ValueAxis axis = (ValueAxis) this.domainAxes.get(index);
      if (axis != null) {
        axisCollection.add(axis, this.getDomainAxisEdge(index));
      }
    }

    // add range axes to lists...
    for (int index = 0; index < this.rangeAxes.size(); index++) {
      final ValueAxis yAxis = (ValueAxis) this.rangeAxes.get(index);
      if (yAxis != null) {
        axisCollection.add(yAxis, this.getRangeAxisEdge(index));
      }
    }

    final Map axisStateMap = new HashMap();

    // draw the top axes
    double cursor = RectangleUtil.getMinY(dataArea)
        - this.axisOffset.calculateTopOutset(dataArea.height);
    Iterator iterator = axisCollection.getAxesAtTop().iterator();
    while (iterator.hasNext()) {
      final ValueAxis axis = (ValueAxis) iterator.next();
      final AxisState info = axis.draw(gc, cursor, plotArea, dataArea,
          RectangleEdge.TOP, plotState);
      cursor = info.getCursor();
      axisStateMap.put(axis, info);
    }

    // draw the bottom axes
    cursor = RectangleUtil.getMaxY(dataArea)
        + this.axisOffset.calculateBottomOutset(dataArea.height);
    iterator = axisCollection.getAxesAtBottom().iterator();
    while (iterator.hasNext()) {
      final ValueAxis axis = (ValueAxis) iterator.next();
      final AxisState info = axis.draw(gc, cursor, plotArea, dataArea,
          RectangleEdge.BOTTOM, plotState);
      cursor = info.getCursor();
      axisStateMap.put(axis, info);
    }

    // draw the left axes
    cursor = RectangleUtil.getMinX(dataArea)
        - this.axisOffset.calculateLeftOutset(dataArea.width);
    iterator = axisCollection.getAxesAtLeft().iterator();
    while (iterator.hasNext()) {
      final ValueAxis axis = (ValueAxis) iterator.next();
      final AxisState info = axis.draw(gc, cursor, plotArea, dataArea,
          RectangleEdge.LEFT, plotState);
      cursor = info.getCursor();
      axisStateMap.put(axis, info);
    }

    // draw the right axes
    cursor = RectangleUtil.getMaxX(dataArea)
        + this.axisOffset.calculateRightOutset(dataArea.width);
    iterator = axisCollection.getAxesAtRight().iterator();
    while (iterator.hasNext()) {
      final ValueAxis axis = (ValueAxis) iterator.next();
      final AxisState info = axis.draw(gc, cursor, plotArea, dataArea,
          RectangleEdge.RIGHT, plotState);
      cursor = info.getCursor();
      axisStateMap.put(axis, info);
    }
View Full Code Here

   *            the paint to use.
   */
  protected void drawHorizontalLine(final GC gc, final Rectangle dataArea,
      final double value) {

    ValueAxis axis = this.getRangeAxis();
    if (this.getOrientation() == PlotOrientation.HORIZONTAL) {
      axis = this.getDomainAxis();
    }
    if (axis.getRange().contains(value)) {
      final int yy = (int) axis.valueToJava2D(value, dataArea,
          RectangleEdge.LEFT);
      gc.drawLine(RectangleUtil.getMinX(dataArea), yy, RectangleUtil
          .getMaxX(dataArea), yy);
    }

View Full Code Here

  protected void drawRangeGridlines(final GC gc, final Rectangle area,
      final List ticks) {

    // draw the range grid lines, if any...
    if (this.isRangeGridlinesVisible()) {
      final ValueAxis axis = this.getRangeAxis();
      if (axis != null) {
        this.applyForegroundColor(gc, COLOR_RANGE_GRIDLINE);
        this.applyStroke(gc, STROKE_RANGE_GRIDLINE);

        for (final Iterator iter = ticks.iterator(); iter.hasNext();) {
View Full Code Here

TOP

Related Classes of com.positive.charts.axis.ValueAxis

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.