/**
  * Resets all member variables within this object recursively
  *
  * <p>Note: Manually written
  */
 public final void initialize() {
   // setBackground( ColorDefinitionImpl.WHITE( ) );
   final LineAttributes lia =
       LineAttributesImpl.create(ColorDefinitionImpl.BLACK(), LineStyle.SOLID_LITERAL, 0);
   lia.setVisible(false);
   setOutline(lia);
   setInsets(InsetsImpl.create(0, 0, 0, 0));
 }
Exemple #2
0
  protected final void initialize() {
    // Outline
    LineAttributes lia =
        LineAttributesImpl.create(ColorDefinitionImpl.BLACK(), LineStyle.SOLID_LITERAL, 1);
    setLineAttributes(lia);

    // Label
    Label lb = LabelImpl.create();
    setLabel(lb);

    // MAJOR GRID
    Grid gr = ComponentFactory.eINSTANCE.createGrid();
    lia =
        LineAttributesImpl.create(
            ColorDefinitionImpl.create(196, 196, 196), LineStyle.SOLID_LITERAL, 1);
    lia.setVisible(true);
    gr.setLineAttributes(lia);
    lia =
        LineAttributesImpl.create(
            ColorDefinitionImpl.create(196, 196, 196), LineStyle.SOLID_LITERAL, 1);
    gr.setTickAttributes(lia);
    gr.setTickStyle(TickStyle.BELOW_LITERAL);
    setMajorGrid(gr);

    // MINOR GRID
    gr = ComponentFactory.eINSTANCE.createGrid();
    lia =
        LineAttributesImpl.create(
            ColorDefinitionImpl.create(225, 225, 225), LineStyle.SOLID_LITERAL, 1);
    lia.setVisible(false);
    gr.setLineAttributes(lia);
    lia =
        LineAttributesImpl.create(
            ColorDefinitionImpl.create(225, 225, 225), LineStyle.SOLID_LITERAL, 1);
    lia.setVisible(false);
    gr.setTickAttributes(lia);
    gr.setTickStyle(TickStyle.BELOW_LITERAL);
    setMinorGrid(gr);

    // SCALE
    Scale sc = ComponentFactory.eINSTANCE.createScale();
    sc.setMinorGridsPerUnit(5);
    setScale(sc);
  }
Exemple #3
0
  /**
   * Initializes all member variables within this object recursively
   *
   * <p>Note: Manually written
   */
  protected void initialize() // SUBCLASSED BY ScatterSeriesImpl
      {
    super.initialize();

    final LineAttributes lia = AttributeFactory.eINSTANCE.createLineAttributes();
    ((LineAttributesImpl) lia).set(ColorDefinitionImpl.BLACK(), LineStyle.SOLID_LITERAL, 1);
    lia.setVisible(true);
    setLineAttributes(lia);
    setLabelPosition(Position.ABOVE_LITERAL);

    final Marker m = AttributeFactory.eINSTANCE.createMarker();
    m.setType(MarkerType.BOX_LITERAL);
    m.setSize(4);
    m.setVisible(true);
    LineAttributes la = AttributeFactory.eINSTANCE.createLineAttributes();
    la.setVisible(true);
    m.setOutline(la);
    getMarkers().add(m);
    setPaletteLineColor(true);
  }
Exemple #4
0
  /**
   * Creates a scatter chart model as a reference implementation
   *
   * @return An instance of the simulated runtime chart model (containing filled datasets)
   */
  public static final Chart createDateTimeScatter() {
    ChartWithAxes cwaScatter = ChartWithAxesImpl.create();

    // TODO: research running script under plugin test.

    cwaScatter.setScript(
        "function beforeDrawAxisLabel(axis, label, context)" //$NON-NLS-1$
            + "{label.getCaption().setValue(\"ABC\"); " //$NON-NLS-1$
            + "axis.setLabel(label);}" //$NON-NLS-1$
        );

    // Plot

    cwaScatter.getPlot().getClientArea().getOutline().setVisible(true);

    // Title
    cwaScatter.getTitle().setVisible(false);

    // X-Axis
    Axis xAxisPrimary = ((ChartWithAxesImpl) cwaScatter).getPrimaryBaseAxes()[0];
    xAxisPrimary.getTitle().getCaption().setValue("Time");
    xAxisPrimary.setType(AxisType.DATE_TIME_LITERAL);
    xAxisPrimary.getTitle().setVisible(true);
    xAxisPrimary.getOrigin().setType(IntersectionType.MIN_LITERAL);

    // Y-Axis
    Axis yAxisPrimary = ((ChartWithAxesImpl) cwaScatter).getPrimaryOrthogonalAxis(xAxisPrimary);
    yAxisPrimary.getTitle().getCaption().setValue("Score");

    yAxisPrimary.getTitle().setBackground(ColorDefinitionImpl.WHITE());
    yAxisPrimary.getTitle().setVisible(true);
    yAxisPrimary.setType(AxisType.LINEAR_LITERAL);
    yAxisPrimary.getOrigin().setType(IntersectionType.MIN_LITERAL);

    // create chart data
    int seriesLen = 10;
    double[] yseries = new double[seriesLen];
    Calendar[] datetime = new Calendar[seriesLen];
    for (int i = 0; i < seriesLen; i++) {
      yseries[i] = ((double) i);
      datetime[i] = new GregorianCalendar();
      datetime[i].setTime(new Date(i));
      // uncomment the following line and chart works ok
      // datetime[i].setTime(new Date(i*1000));
    }
    NumberDataSet dsNumericValues2 = NumberDataSetImpl.create(yseries);
    DateTimeDataSet dsDateTime = DateTimeDataSetImpl.create(datetime);

    // X-Series
    Series seBase = SeriesImpl.create();
    seBase.setDataSet(dsDateTime);
    SeriesDefinition sdX = SeriesDefinitionImpl.create();
    xAxisPrimary.getSeriesDefinitions().add(sdX);
    sdX.getSeries().add(seBase);

    // Y-Series
    ScatterSeries ss = (ScatterSeries) ScatterSeriesImpl.create();
    ss.setDataSet(dsNumericValues2);
    SeriesDefinition sdY = SeriesDefinitionImpl.create();
    yAxisPrimary.getSeriesDefinitions().add(sdY);
    sdY.getSeries().add(ss);

    return cwaScatter;
  }