com.github.mikephil.charting.components.YAxis.setValueFormatter()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(8.1k)|赞(0)|评价(0)|浏览(209)

本文整理了Java中com.github.mikephil.charting.components.YAxis.setValueFormatter()方法的一些代码示例,展示了YAxis.setValueFormatter()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YAxis.setValueFormatter()方法的具体详情如下:
包路径:com.github.mikephil.charting.components.YAxis
类名称:YAxis
方法名:setValueFormatter

YAxis.setValueFormatter介绍

暂无

代码示例

代码示例来源:origin: PhilJay/MPAndroidChart

chart.getAxisRight().setDrawZeroLine(true);
chart.getAxisRight().setLabelCount(7, false);
chart.getAxisRight().setValueFormatter(new CustomFormatter());
chart.getAxisRight().setTextSize(9f);

代码示例来源:origin: PhilJay/MPAndroidChart

leftAxis.setValueFormatter(new MyValueFormatter("K"));
leftAxis.setAxisMinimum(0f); // this replaces setStartAtZero(true)
chart.getAxisRight().setEnabled(false);

代码示例来源:origin: PhilJay/MPAndroidChart

leftAxis.setValueFormatter(new LargeValueFormatter());
leftAxis.setDrawGridLines(false);
leftAxis.setSpaceTop(35f);

代码示例来源:origin: PhilJay/MPAndroidChart

leftAxis.setTypeface(tfLight);
leftAxis.setLabelCount(8, false);
leftAxis.setValueFormatter(custom);
leftAxis.setPosition(YAxisLabelPosition.OUTSIDE_CHART);
leftAxis.setSpaceTop(15f);
rightAxis.setTypeface(tfLight);
rightAxis.setLabelCount(8, false);
rightAxis.setValueFormatter(custom);
rightAxis.setSpaceTop(15f);
rightAxis.setAxisMinimum(0f); // this replaces setStartAtZero(true)

代码示例来源:origin: fossasia/pslab-android

left.setValueFormatter(new LogicAnalyzerAxisFormatter(channelNames));
left.setTextColor(Color.WHITE);
left.setGranularity(1f);

代码示例来源:origin: fossasia/pslab-android

left.setValueFormatter(new LogicAnalyzerAxisFormatter(channelNames));
left.setTextColor(Color.WHITE);
left.setGranularity(1f);

代码示例来源:origin: fossasia/pslab-android

left.setValueFormatter(new LogicAnalyzerAxisFormatter(channelNames));
left.setTextColor(Color.WHITE);
left.setGranularity(1f);

代码示例来源:origin: fossasia/pslab-android

left.setValueFormatter(new LogicAnalyzerAxisFormatter(channelNames));
left.setTextColor(Color.WHITE);
left.setGranularity(1f);

代码示例来源:origin: WenWangAndroid/ChartManager

rightAxis.setValueFormatter(new IAxisValueFormatter() {
  @Override
  public String getFormattedValue(float value, AxisBase axis) {

代码示例来源:origin: xiaolongonly/Ticket-Analysis

lcParityTrend.getAxisLeft().setValueFormatter((value, axis) -> value % 2 == 1 ? "奇" : "偶");

代码示例来源:origin: purrprogramming/voice-pitch-analyzer

chart.getAxisRight().setDrawGridLines(false);
chart.getXAxis().setDrawGridLines(false);
chart.getAxisLeft().setValueFormatter(new GraphValueFormatter());
chart.getAxisRight().setValueFormatter(new GraphValueFormatter());
chart.setDrawBorders(false);
chart.getAxisLeft().setAxisMinValue(PitchCalculator.minPitch.floatValue());
chart.getAxisLeft().setValueFormatter(new GraphValueFormatter());
chart.getAxisRight().setValueFormatter(new GraphValueFormatter());
chart.setDrawBorders(false);

代码示例来源:origin: xiaolongonly/Ticket-Analysis

return "0";
});
lcParityTrend.getAxisLeft().setValueFormatter((value, axis) -> value + "");
lcParityTrend.setMarker(new DataMarkView(this, new DataMarkView.IDataValueFormat() {
  @Override

代码示例来源:origin: zhuanghongji/mp-android-chart

protected void setup(Chart<?> chart) {
  mTf = Typeface.createFromAsset(getAssets(), "OpenSans-Regular.ttf");
  // no description text
  chart.getDescription().setEnabled(false);
  // enable touch gestures
  chart.setTouchEnabled(true);
  if (chart instanceof BarLineChartBase) {
    BarLineChartBase mChart = (BarLineChartBase) chart;
    mChart.setDrawGridBackground(false);
    // enable scaling and dragging
    mChart.setDragEnabled(true);
    mChart.setScaleEnabled(true);
    // if disabled, scaling can be done on x- and y-axis separately
    mChart.setPinchZoom(false);
    YAxis leftAxis = mChart.getAxisLeft();
    leftAxis.removeAllLimitLines(); // reset all limit lines to avoid overlapping lines
    leftAxis.setTypeface(mTf);
    leftAxis.setTextSize(8f);
    leftAxis.setTextColor(Color.DKGRAY);
    leftAxis.setValueFormatter(new PercentFormatter());
    XAxis xAxis = mChart.getXAxis();
    xAxis.setTypeface(mTf);
    xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
    xAxis.setTextSize(8f);
    xAxis.setTextColor(Color.DKGRAY);
    mChart.getAxisRight().setEnabled(false);
  }
}

代码示例来源:origin: zhuanghongji/mp-android-chart

leftAxis.setValueFormatter(new MyAxisValueFormatter());
leftAxis.setAxisMinimum(0f); // this replaces setStartAtZero(true)
mChart.getAxisRight().setEnabled(false);

代码示例来源:origin: WallaceXiao/StockChart-MPAndroidChart

/**
 * 副图指标RSI
 */
public void setRSIToChart() {
  if (barChart != null) {
    if (barChart.getBarData() != null) {
      barChart.getBarData().clearValues();
    }
    if (barChart.getLineData() != null) {
      barChart.getLineData().clearValues();
    }
    if (barChart.getCandleData() != null) {
      barChart.getCandleData().clearValues();
    }
    axisLeftBar.resetAxisMaximum();
    axisLeftBar.resetAxisMinimum();
    axisLeftBar.setValueFormatter(new IAxisValueFormatter() {
      @Override
      public String getFormattedValue(float value, AxisBase axis) {
        return NumberUtils.keepPrecision(value, precision);
      }
    });
    CombinedData combinedData = barChart.getData();
    combinedData.setData(new LineData(kLineData.getLineDataRSI()));
    barChart.notifyDataSetChanged();
    barChart.invalidate();
  }
}

代码示例来源:origin: WallaceXiao/StockChart-MPAndroidChart

/**
 * 副图指标KDJ
 */
public void setKDJToChart() {
  if (barChart != null) {
    if (barChart.getBarData() != null) {
      barChart.getBarData().clearValues();
    }
    if (barChart.getLineData() != null) {
      barChart.getLineData().clearValues();
    }
    if (barChart.getCandleData() != null) {
      barChart.getCandleData().clearValues();
    }
    axisLeftBar.resetAxisMaximum();
    axisLeftBar.resetAxisMinimum();
    axisLeftBar.setValueFormatter(new IAxisValueFormatter() {
      @Override
      public String getFormattedValue(float value, AxisBase axis) {
        return NumberUtils.keepPrecision(value, precision);
      }
    });
    CombinedData combinedData = barChart.getData();
    combinedData.setData(new LineData(kLineData.getLineDataKDJ()));
    barChart.notifyDataSetChanged();
    barChart.invalidate();
  }
}

代码示例来源:origin: zhuanghongji/mp-android-chart

leftAxis.setValueFormatter(new LargeValueFormatter());
leftAxis.setDrawGridLines(false);
leftAxis.setSpaceTop(30f);

代码示例来源:origin: WallaceXiao/StockChart-MPAndroidChart

/**
 * 副图指标MACD
 */
public void setMACDToChart() {
  if (barChart != null) {
    if (barChart.getBarData() != null) {
      barChart.getBarData().clearValues();
    }
    if (barChart.getLineData() != null) {
      barChart.getLineData().clearValues();
    }
    if (barChart.getCandleData() != null) {
      barChart.getCandleData().clearValues();
    }
    axisLeftBar.resetAxisMaximum();
    axisLeftBar.resetAxisMinimum();
    axisLeftBar.setValueFormatter(new IAxisValueFormatter() {
      @Override
      public String getFormattedValue(float value, AxisBase axis) {
        return NumberUtils.keepPrecision(value, precision);
      }
    });
    CombinedData combinedData = barChart.getData();
    combinedData.setData(new LineData(kLineData.getLineDataMACD()));
    combinedData.setData(new BarData(kLineData.getBarDataMACD()));
    barChart.notifyDataSetChanged();
    barChart.invalidate();
  }
}

代码示例来源:origin: WallaceXiao/StockChart-MPAndroidChart

/**
 * 副图指标BOLL
 */
public void setBOLLToChart() {
  if (barChart != null) {
    if (barChart.getBarData() != null) {
      barChart.getBarData().clearValues();
    }
    if (barChart.getLineData() != null) {
      barChart.getLineData().clearValues();
    }
    if (barChart.getCandleData() != null) {
      barChart.getCandleData().clearValues();
    }
    axisLeftBar.resetAxisMaximum();
    axisLeftBar.resetAxisMinimum();
    axisLeftBar.setValueFormatter(new IAxisValueFormatter() {
      @Override
      public String getFormattedValue(float value, AxisBase axis) {
        return NumberUtils.keepPrecision(value, precision);
      }
    });
    CombinedData combinedData = barChart.getData();
    combinedData.setData(new CandleData(kLineData.getBollCandleDataSet()));
    combinedData.setData(new LineData(kLineData.getLineDataBOLL()));
    barChart.notifyDataSetChanged();
    barChart.invalidate();
  }
}

代码示例来源:origin: WallaceXiao/StockChart-MPAndroidChart

/**
 * 副图指标成交量
 */
public void setVolumeToChart() {
  if (barChart != null) {
    if (barChart.getBarData() != null) {
      barChart.getBarData().clearValues();
    }
    if (barChart.getLineData() != null) {
      barChart.getLineData().clearValues();
    }
    if (barChart.getCandleData() != null) {
      barChart.getCandleData().clearValues();
    }
    axisLeftBar.resetAxisMaximum();
    axisLeftBar.resetAxisMinimum();
    axisLeftBar.setAxisMinimum(0);
    axisLeftBar.setValueFormatter(new VolFormatter(mContext, kLineData.getAssetId()));
    CombinedData combinedData = barChart.getData();
    combinedData.setData(new BarData(kLineData.getVolumeDataSet()));
    combinedData.setData(new LineData());
    barChart.notifyDataSetChanged();
    barChart.animateY(1000);
  }
}

相关文章

YAxis类方法