Package org.timepedia.chronoscope.client.plot

Examples of org.timepedia.chronoscope.client.plot.DefaultXYPlot


  public StaticImageChartPanel(Dataset[] ds, boolean interactive, int width,
      int height, GssContext gssContext) {
    this.interactive = interactive;
    chart = new Chart();
    plot = new DefaultXYPlot();
    Datasets dss = new Datasets(ds);

    plot.setDatasets(dss);
    plot.setOverviewEnabled(false);
    plot.setPlotRenderer(new XYPlotRenderer());
View Full Code Here


    Chronoscope chrono = Chronoscope.getInstance();
   
    ChartPanel chartPanel = Chronoscope.createTimeseriesChartById("chart", ChartDemoSlowIE.getJsons("jagged"), 480, 320, new ViewReadyCallback() {
      public void onViewReady(View view) {
       
        DefaultXYPlot theplot = (DefaultXYPlot) view.getChart().getPlot();
       
        theplot.setAutoZoomVisibleRange(0, true);
        theplot.setAnimationPreview(false);

        Datasets datasets = theplot.getDatasets();
        Dataset d = theplot.getDatasets().get(0);
        d.setIncrementalHandler(new IncrementalHandler() {
          public void onDataNeeded(Interval domain, Dataset dataset,
              IncrementalDataResponse response) {
          }
        });
View Full Code Here

      int height) {

    Datasets<Tuple2D> datasets = new Datasets<Tuple2D>(ds);
    XYPlotRenderer plotRenderer = new XYPlotRenderer();

    DefaultXYPlot plot = new DefaultXYPlot();
    plot.setDatasets(datasets);
    plot.setPlotRenderer(plotRenderer);

    return new MockChartPanel(plot, width, height);
  }
View Full Code Here


    label = new JLabel();

    chart = new Chart();
    plot = new DefaultXYPlot();
    plot.setDatasets(new Datasets(xyDatasets));
    XYPlotRenderer plotRenderer = new XYPlotRenderer();
    plot.setPlotRenderer(plotRenderer);
    chart.setPlot(plot);
View Full Code Here

  private static double hiliteRelativeGrabX;
   
  public void onMouseMove(MouseMoveEvent event) {
    ChartState chartInfo = getChartState(event);
    Chart chart = chartInfo.chart;
    DefaultXYPlot plot = (DefaultXYPlot)chartInfo.chart.getPlot();
   
    if (null == plot.getBounds() || !plot.isOverviewVisible()) {
      return;
    }
   
    OverviewAxisPanel oaPanel = plot.getOverviewAxisPanel();
    ValueAxis overviewAxis = oaPanel.getValueAxis();
    Bounds overviewAxisBounds = oaPanel.getBounds();
    Bounds hiliteBounds = oaPanel.getHighlightBounds();
    CompoundUIAction uiAction = chartInfo.getCompoundUIAction();
   
    // Translate the view (x,y) point into an (x,y) point relative to
    // the OverviewAxisPanel.
    Bounds plotBounds = plot.getBounds();
    int x = getLocalX(event) - (int)plotBounds.x;
    int y = getLocalY(event) - (int)plotBounds.bottomY();

    final boolean isInAxisBounds = null == hiliteBounds ? false: overviewAxisBounds.inside(x, y);
    final boolean isDragging = uiAction.isDragging(overviewAxis);
   
    //log("onMouseMove(" + x + ", " + y + ")" + ": inAxisBounds=" + isInAxisBounds + "; uiAction.startX=" + uiAction.getEndX());
   
    // Determine appropriate cursor type
    if (isInAxisBounds) {
      if (hiliteBounds != null && hiliteBounds.inside(x, y)) {
        chartInfo.chart.setCursor(Cursor.DRAGGABLE);
      }
      else {
        chartInfo.chart.setCursor(Cursor.DEFAULT);
      }
    }
    // else, mouse is outside of overview axis, so don't mess with cursor.
   
    // final double viewOffsetX = plotBounds.x;
    final double viewOffsetX = 0;
   
    if (uiAction.isSelecting(overviewAxis)) {
      chart.setAnimating(true);

      chart.setCursor(Cursor.SELECTING);
      chart.setAnimating(true);
      // Determine the start and end domain of the highlight selection
      double startDomainX = toDomainX(uiAction.getStartX(), plot);
      double boundedX = MathUtil.bound(x, overviewAxisBounds.x, overviewAxisBounds.rightX());
      double endDomainX = toDomainX(boundedX + viewOffsetX, plot);
      if (startDomainX > endDomainX) {
        double tmp = startDomainX;
        startDomainX = endDomainX;
        endDomainX = tmp;
      }
      // Set the current highlight region in the plot
      //  TODO - think about setting highlightPanel.bounds instead
      plot.setHighlight(startDomainX, endDomainX);
      plot.getDomain().setEndpoints(startDomainX, endDomainX);
      plot.redraw();
    }
    else if (hiliteBounds != null && isDragging) {
      chart.setAnimating(true);
     
      // hiliteLeftDomainX represents the domain-x value of the left edge
      // of the highlight window within the overview axis.
      //double hiliteLeftX = x - (hiliteBounds.width / 2.0);x will always be at the center of the hiliteBounds

      double hiliteLeftX = x - hiliteRelativeGrabX;
      double hiliteLeftDomainX = toDomainX(hiliteLeftX + viewOffsetX, plot);
    
      // Need to bound the domain-x value so that the highlight box doesn't
      // run off the overview axis.
      double minHiliteDomain = plot.getWidestDomain().getStart();
      double maxHiliteDomain = toDomainX(overviewAxisBounds.rightX() + viewOffsetX - hiliteBounds.width, plot);

      hiliteLeftDomainX = MathUtil.bound(hiliteLeftDomainX, minHiliteDomain, maxHiliteDomain);

      plot.moveTo(hiliteLeftDomainX);
    }
  }
View Full Code Here

    plotPanel = new PlotPanel();
    initWidget(plotPanel);
  }

  protected XYPlot createPlot(Dataset[] datasetArray) {
    plot = new DefaultXYPlot();
    plot.setDatasets(new Datasets<Tuple2D>(datasetArray));
    plot.setPlotRenderer(new XYPlotRenderer());
    return plot;
  }
View Full Code Here

TOP

Related Classes of org.timepedia.chronoscope.client.plot.DefaultXYPlot

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.