當前位置: 首頁>>代碼示例>>Java>>正文


Java XYMultipleSeriesRenderer.addYTextLabel方法代碼示例

本文整理匯總了Java中org.achartengine.renderer.XYMultipleSeriesRenderer.addYTextLabel方法的典型用法代碼示例。如果您正苦於以下問題:Java XYMultipleSeriesRenderer.addYTextLabel方法的具體用法?Java XYMultipleSeriesRenderer.addYTextLabel怎麽用?Java XYMultipleSeriesRenderer.addYTextLabel使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.achartengine.renderer.XYMultipleSeriesRenderer的用法示例。


在下文中一共展示了XYMultipleSeriesRenderer.addYTextLabel方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: execute

import org.achartengine.renderer.XYMultipleSeriesRenderer; //導入方法依賴的package包/類
/**
 * Executes the chart demo.
 * 
 * @param context the context
 * @return the built intent
 */
public Intent execute(Context context) {
  double[] minValues = new double[] { -24, -19, -10, -1, 7, 12, 15, 14, 9, 1, -11, -16 };
  double[] maxValues = new double[] { 7, 12, 24, 28, 33, 35, 37, 36, 28, 19, 11, 4 };

  XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset();
  RangeCategorySeries series = new RangeCategorySeries("Temperature");
  int length = minValues.length;
  for (int k = 0; k < length; k++) {
    series.add(minValues[k], maxValues[k]);
  }
  dataset.addSeries(series.toXYSeries());
  int[] colors = new int[] { Color.CYAN };
  XYMultipleSeriesRenderer renderer = buildBarRenderer(colors);
  setChartSettings(renderer, "Monthly temperature range", "Month", "Celsius degrees", 0.5, 12.5,
      -30, 45, Color.GRAY, Color.LTGRAY);
  renderer.setBarSpacing(0.5);
  renderer.setXLabels(0);
  renderer.setYLabels(10);
  renderer.addXTextLabel(1, "Jan");
  renderer.addXTextLabel(3, "Mar");
  renderer.addXTextLabel(5, "May");
  renderer.addXTextLabel(7, "Jul");
  renderer.addXTextLabel(10, "Oct");
  renderer.addXTextLabel(12, "Dec");
  renderer.addYTextLabel(-25, "Very cold");
  renderer.addYTextLabel(-10, "Cold");
  renderer.addYTextLabel(5, "OK");
  renderer.addYTextLabel(20, "Nice");
  renderer.setMargins(new int[] {30, 70, 10, 0});
  renderer.setYLabelsAlign(Align.RIGHT);
  XYSeriesRenderer r = (XYSeriesRenderer) renderer.getSeriesRendererAt(0);
  r.setDisplayChartValues(true);
  r.setChartValuesTextSize(12);
  r.setChartValuesSpacing(3);
  r.setGradientEnabled(true);
  r.setGradientStart(-20, Color.BLUE);
  r.setGradientStop(20, Color.GREEN);
  return ChartFactory.getRangeBarChartIntent(context, dataset, renderer, Type.DEFAULT,
      "Temperature range");
}
 
開發者ID:ddanny,項目名稱:achartengine,代碼行數:47,代碼來源:TemperatureChart.java

示例2: execute

import org.achartengine.renderer.XYMultipleSeriesRenderer; //導入方法依賴的package包/類
/**
 * Executes the chart demo.
 * 
 * @param context the context
 * @return the built intent
 */
public Intent execute(Context context) {
  String[] titles = new String[] { "New tickets", "Fixed tickets" };
  List<Date[]> dates = new ArrayList<Date[]>();
  List<double[]> values = new ArrayList<double[]>();
  int length = titles.length;
  for (int i = 0; i < length; i++) {
    dates.add(new Date[12]);
    dates.get(i)[0] = new Date(108, 9, 1);
    dates.get(i)[1] = new Date(108, 9, 8);
    dates.get(i)[2] = new Date(108, 9, 15);
    dates.get(i)[3] = new Date(108, 9, 22);
    dates.get(i)[4] = new Date(108, 9, 29);
    dates.get(i)[5] = new Date(108, 10, 5);
    dates.get(i)[6] = new Date(108, 10, 12);
    dates.get(i)[7] = new Date(108, 10, 19);
    dates.get(i)[8] = new Date(108, 10, 26);
    dates.get(i)[9] = new Date(108, 11, 3);
    dates.get(i)[10] = new Date(108, 11, 10);
    dates.get(i)[11] = new Date(108, 11, 17);
  }
  values.add(new double[] { 142, 123, 142, 152, 149, 122, 110, 120, 125, 155, 146, 150 });
  values.add(new double[] { 102, 90, 112, 105, 125, 112, 125, 112, 105, 115, 116, 135 });
  length = values.get(0).length;
  int[] colors = new int[] { Color.BLUE, Color.GREEN };
  PointStyle[] styles = new PointStyle[] { PointStyle.POINT, PointStyle.POINT };
  XYMultipleSeriesRenderer renderer = buildRenderer(colors, styles);
  setChartSettings(renderer, "Project work status", "Date", "Tickets", dates.get(0)[0].getTime(),
      dates.get(0)[11].getTime(), 50, 190, Color.GRAY, Color.LTGRAY);
  renderer.setXLabels(0);
  renderer.setYLabels(10);
  renderer.addYTextLabel(100, "test");
  length = renderer.getSeriesRendererCount();
  for (int i = 0; i < length; i++) {
    XYSeriesRenderer seriesRenderer = (XYSeriesRenderer) renderer.getSeriesRendererAt(i);
    seriesRenderer.setDisplayChartValues(true);
  }
  renderer.setXRoundedLabels(false);
  return ChartFactory.getTimeChartIntent(context, buildDateDataset(titles, dates, values),
      renderer, "MM/dd/yyyy");
}
 
開發者ID:ddanny,項目名稱:achartengine,代碼行數:47,代碼來源:ProjectStatusChart.java


注:本文中的org.achartengine.renderer.XYMultipleSeriesRenderer.addYTextLabel方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。