示例#1
0
 protected void addCustomLabels() {
   Axis axis = chart1.getAxes().getLeft();
   AxisLabelsItems items = axis.getCustomLabels();
   // remove all custom labels
   items.clear();
   // add custom labels
   AxisLabelItem item;
   item = items.add(123.0, "Hello");
   item.getFont().setSize(16);
   item = items.add(466.0, "Good\nBye");
   item.setTransparent(false);
   items.add(300);
   item = items.add(-100);
   item.setTransparent(false);
   item.setTransparency(50);
   item.setColor(Color.BLUE);
 }
示例#2
0
  private static void populateAndPlotFuelMap(final String data) {

    mapOffset += 16;

    String[] mapmap = data.trim().split(" ");
    for (int x = 3; x < 35; x++) {
      mapData.append(mapmap[x]);
      mapData.append(" ");
    }

    if (mapOffset < 512) {
      sendRequest(mapOffset);
      return;
    }

    String[] map = mapData.toString().trim().split(" ");
    short cnt = 0;

    chart.setAutoRepaint(false);
    ser.clear();

    for (int x = 0; x < 32; x++) {
      for (int y = 0; y < 16; y++) {
        double val =
            Double.parseDouble(
                String.format("%.0f", Integer.parseInt(map[cnt] + map[cnt + 1], 16) / 128f));
        val = val - 95;
        ser.add(x, val, y);
        if (DEBUG_MODE) Log.d(TAG, String.format("%d:%d = %.0f", x, y, val));
        cnt = (short) (cnt + 2);
      }
    }

    for (int x = 0; x < chart.getAxes().getCount(); x++) {
      chart.getAxes().getAxis(x).getLabels().getItems().clear();
    }

    for (double x = 0; x < 32; x++) {
      AxisLabelItem itm = chart.getAxes().getBottom().getLabels().getItems().add(x);
      itm.getFont().setSize(10);
      itm.getFont().setColor(com.steema.teechart.drawing.Color.white);
      itm.setText(String.format("%.0f", 300 * x));
    }

    for (double x = 0; x < 16; x++) {
      AxisLabelItem itm =
          chart
              .getAxes()
              .getDepth()
              .getLabels()
              .getItems()
              .add(x, x == 0 ? " " : String.format("%.0f", 13 * x));
      itm.getFont().setSize(10);
      itm.getFont().setColor(com.steema.teechart.drawing.Color.white);
    }

    chart.getAxes().getBottom().getTitle().setText("Engine RPM");
    chart
        .getAxes()
        .getBottom()
        .getTitle()
        .getFont()
        .setColor(com.steema.teechart.drawing.Color.white);
    chart.getAxes().getBottom().getTitle().getFont().setSize(14);

    chart.getAxes().getDepth().getTitle().setText("MAP (kPa)");
    chart
        .getAxes()
        .getDepth()
        .getTitle()
        .getFont()
        .setColor(com.steema.teechart.drawing.Color.white);
    chart.getAxes().getDepth().getTitle().getFont().setSize(14);

    chart.refreshControl();
    chart.setAutoRepaint(true);

    if (progress != null && progress.isShowing()) progress.dismiss();

    lastRegister = REGISTER_4096_PLUS_SEVEN;
    mapMode = false;
  }