gpt4 book ai didi

com.github.mikephil.charting.components.YAxis类的使用及代码示例

转载 作者:知者 更新时间:2024-03-17 08:32:40 28 4
gpt4 key购买 nike

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

YAxis介绍

[英]Class representing the y-axis labels settings and its entries. Only use the setter methods to modify it. Do not access public variables directly. Be aware that not all features the YLabels class provides are suitable for the RadarChart. Customizations that affect the value range of the axis need to be applied before setting data for the chart.
[中]类,表示y轴标签设置及其条目。只能使用setter方法来修改它。不要直接访问公共变量。请注意,并非YLabels类提供的所有功能都适用于RadarChart。在为图表设置数据之前,需要应用影响轴值范围的自定义设置。

代码示例

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

leftAxis.setAxisMaximum(900f);
leftAxis.setAxisMinimum(-250f);
leftAxis.setDrawAxisLine(false);
leftAxis.setDrawZeroLine(false);
leftAxis.setDrawGridLines(false);
chart.getAxisRight().setEnabled(false);

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

chart.setHighlightFullBarEnabled(false);
chart.getAxisLeft().setEnabled(false);
chart.getAxisRight().setAxisMaximum(25f);
chart.getAxisRight().setAxisMinimum(-25f);
chart.getAxisRight().setDrawGridLines(false);
chart.getAxisRight().setDrawZeroLine(true);
chart.getAxisRight().setLabelCount(7, false);
chart.getAxisRight().setValueFormatter(new CustomFormatter());
chart.getAxisRight().setTextSize(9f);

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

public void renderAxisLabels(Canvas c) {
  if (!mYAxis.isEnabled() || !mYAxis.isDrawLabelsEnabled())
    return;
  mAxisLabelPaint.setTypeface(mYAxis.getTypeface());
  mAxisLabelPaint.setTextSize(mYAxis.getTextSize());
  mAxisLabelPaint.setColor(mYAxis.getTextColor());
  float xoffset = mYAxis.getXOffset();
  float yoffset = Utils.calcTextHeight(mAxisLabelPaint, "A") / 2.5f + mYAxis.getYOffset();
  AxisDependency dependency = mYAxis.getAxisDependency();
  YAxisLabelPosition labelPosition = mYAxis.getLabelPosition();

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

/**
 * Returns true if this axis needs horizontal offset, false if no offset is needed.
 *
 * @return
 */
public boolean needsOffset() {
  if (isEnabled() && isDrawLabelsEnabled() && getLabelPosition() == YAxisLabelPosition
      .OUTSIDE_CHART)
    return true;
  else
    return false;
}

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

/**
 * This method is deprecated.
 * Use setAxisMinimum(...) / setAxisMaximum(...) instead.
 *
 * @param startAtZero
 */
@Deprecated
public void setStartAtZero(boolean startAtZero) {
  if (startAtZero)
    setAxisMinimum(0f);
  else
    resetAxisMinimum();
}

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

@Override
public void renderAxisLabels(Canvas c) {
  if (!mYAxis.isEnabled() || !mYAxis.isDrawLabelsEnabled())
    return;
  mAxisLabelPaint.setTypeface(mYAxis.getTypeface());
  mAxisLabelPaint.setTextSize(mYAxis.getTextSize());
  mAxisLabelPaint.setColor(mYAxis.getTextColor());
  MPPointF center = mChart.getCenterOffsets();
  MPPointF pOut = MPPointF.getInstance(0,0);
  float factor = mChart.getFactor();
  final int from = mYAxis.isDrawBottomYLabelEntryEnabled() ? 0 : 1;
  final int to = mYAxis.isDrawTopYLabelEntryEnabled()
      ? mYAxis.mEntryCount
      : (mYAxis.mEntryCount - 1);
  for (int j = from; j < to; j++) {
    float r = (mYAxis.mEntries[j] - mYAxis.mAxisMinimum) * factor;
    Utils.getPosition(center, r, mChart.getRotationAngle(), pOut);
    String label = mYAxis.getFormattedLabel(j);
    c.drawText(label, pOut.x + 10, pOut.y, mAxisLabelPaint);
  }
  MPPointF.recycleInstance(center);
  MPPointF.recycleInstance(pOut);
}

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

private void setupInstruments() {
  baroMeter.setMaxSpeed(PreferenceManager.getDefaultSharedPreferences(getActivity()).getFloat(baroSensor.BAROMETER_LIMIT, 2));
  XAxis x = mChart.getXAxis();
  this.y = mChart.getAxisLeft();
  YAxis y2 = mChart.getAxisRight();
  mChart.setTouchEnabled(true);
  mChart.setHighlightPerDragEnabled(true);
  mChart.setDragEnabled(true);
  mChart.setScaleEnabled(true);
  mChart.setDrawGridBackground(false);
  mChart.setPinchZoom(true);
  mChart.setScaleYEnabled(true);
  mChart.setBackgroundColor(Color.BLACK);
  mChart.getDescription().setEnabled(false);
  LineData data = new LineData();
  mChart.setData(data);
  Legend l = mChart.getLegend();
  l.setForm(Legend.LegendForm.LINE);
  l.setTextColor(Color.WHITE);
  x.setTextColor(Color.WHITE);
  x.setDrawGridLines(true);
  x.setAvoidFirstLastClipping(true);
  y.setTextColor(Color.WHITE);
  y.setAxisMaximum(currentMax);
  y.setAxisMinimum(currentMin);
  y.setDrawGridLines(true);
  y.setLabelCount(10);
  y2.setDrawGridLines(false);
  y2.setMaxWidth(0);
}

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

left.setDrawLabels(false);
left.setSpaceTop(25f);
left.setSpaceBottom(25f);
left.setDrawAxisLine(false);
left.setDrawGridLines(false);
left.setDrawZeroLine(true); // draw a zero line
left.setZeroLineColor(Color.GRAY);
left.setZeroLineWidth(0.7f);
chart.getAxisRight().setEnabled(false);
chart.getLegend().setEnabled(false);

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

leftAxis.setTypeface(tfLight);
leftAxis.setTextColor(Color.WHITE);
leftAxis.setAxisMaximum(100f);
leftAxis.setAxisMinimum(0f);
leftAxis.setDrawGridLines(true);
rightAxis.setEnabled(false);

代码示例来源:origin: Sparker0i/Weather

yAxisRight.setDrawGridLines(false);
yAxisRight.setDrawAxisLine(false);
yAxisRight.setDrawLabels(false);
yAxisRight.setTextColor(Color.WHITE);
yAxisRight.enableAxisLineDashedLine(2f , 4f , 2f);
yAxisLeft.setTextColor(Color.WHITE);

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

leftAxis.setPosition(YAxis.YAxisLabelPosition.INSIDE_CHART);
leftAxis.setTypeface(tfLight);
leftAxis.setTextColor(ColorTemplate.getHoloBlue());
leftAxis.setDrawGridLines(true);
leftAxis.setGranularityEnabled(true);
leftAxis.setAxisMinimum(0f);
leftAxis.setAxisMaximum(170f);
leftAxis.setYOffset(-9f);
leftAxis.setTextColor(Color.rgb(255, 192, 56));
rightAxis.setEnabled(false);

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

left.setValueFormatter(new LogicAnalyzerAxisFormatter(channelNames));
left.setTextColor(Color.WHITE);
left.setGranularity(1f);
left.setTextSize(12f);
logicLinesChart.getAxisRight().setDrawLabels(false);
logicLinesChart.getDescription().setEnabled(false);
logicLinesChart.setScaleYEnabled(false);

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

statMin.setText(String.valueOf(baroValue));
y.setAxisMaximum(currentMax);
y.setAxisMinimum(currentMin);
y.setLabelCount(10);
if (baroValue >= 0) {
  baroMeter.setWithTremble(false);

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

leftAxis.setLabelCount(7, false);
leftAxis.setDrawGridLines(false);
leftAxis.setDrawAxisLine(false);
rightAxis.setEnabled(false);

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

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

代码示例来源:origin: WJKCharlie/MPAndroidChartTest

leftAxis.setPosition(YAxis.YAxisLabelPosition.OUTSIDE_CHART);//设置y轴标签显示在外侧
leftAxis.setAxisMinimum(0f);//设置Y轴最小值
leftAxis.setDrawGridLines(false);
leftAxis.setDrawLabels(false);//禁止绘制y轴标签
leftAxis.setDrawAxisLine(false);//禁止绘制y轴
barChart.getAxisRight().setEnabled(false);//禁用右侧y轴

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

leftAxis.setTypeface(tfLight);
leftAxis.setLabelCount(6, false);
leftAxis.setAxisMinimum(-2.5f);
leftAxis.setAxisMaximum(2.5f);
leftAxis.setGranularityEnabled(true);
leftAxis.setGranularity(0.1f);
rightAxis.setDrawGridLines(false);
rightAxis.setTypeface(tfLight);
rightAxis.setLabelCount(6, false);
rightAxis.setAxisMinimum(-2.5f);
rightAxis.setAxisMaximum(2.5f);
rightAxis.setGranularity(0.1f);

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

y.setTypeface(tfLight);
y.setLabelCount(6, false);
y.setTextColor(Color.WHITE);
y.setPosition(YAxis.YAxisLabelPosition.INSIDE_CHART);
y.setDrawGridLines(false);
y.setAxisLineColor(Color.WHITE);
chart.getAxisRight().setEnabled(false);

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

leftAxis.setTypeface(tfLight);
leftAxis.setValueFormatter(new LargeValueFormatter());
leftAxis.setDrawGridLines(false);
leftAxis.setSpaceTop(35f);
leftAxis.setAxisMinimum(0f); // this replaces setStartAtZero(true)
chart.getAxisRight().setEnabled(false);

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

leftAxis.setTypeface(tfLight);
leftAxis.setTextColor(ColorTemplate.getHoloBlue());
leftAxis.setAxisMaximum(200f);
leftAxis.setAxisMinimum(0f);
leftAxis.setDrawGridLines(true);
leftAxis.setGranularityEnabled(true);
rightAxis.setTypeface(tfLight);
rightAxis.setTextColor(Color.RED);
rightAxis.setAxisMaximum(900);
rightAxis.setAxisMinimum(-200);
rightAxis.setDrawGridLines(false);
rightAxis.setDrawZeroLine(false);
rightAxis.setGranularityEnabled(false);

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com