• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java YAxisValueFormatter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.github.mikephil.charting.formatter.YAxisValueFormatter的典型用法代码示例。如果您正苦于以下问题:Java YAxisValueFormatter类的具体用法?Java YAxisValueFormatter怎么用?Java YAxisValueFormatter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



YAxisValueFormatter类属于com.github.mikephil.charting.formatter包,在下文中一共展示了YAxisValueFormatter类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: setData

import com.github.mikephil.charting.formatter.YAxisValueFormatter; //导入依赖的package包/类
private void setData(List<Integer> valueList, String format) {

        mChart.setVisibility(View.VISIBLE);

        ArrayList<String> xVals = new ArrayList<String>();
        ArrayList<BarEntry> yVals1 = new ArrayList<BarEntry>();

        for (int i = 0; i < valueList.size(); i++) {
            xVals.add(i + "s");
            yVals1.add(new BarEntry(valueList.get(i), i));
        }

        String legend = "reception rate per second";

        if (!format.equals("%"))
            legend = "packet count per second";

        BarDataSet set1 = new BarDataSet(yVals1, legend);
        set1.setBarSpacePercent(35f);
        set1.setColor(Color.parseColor("#0288D1"));

        ArrayList<IBarDataSet> dataSets = new ArrayList<IBarDataSet>();
        dataSets.add(set1);

        BarData data = new BarData(xVals, dataSets);
        data.setValueTextSize(10f);

        data.setDrawValues(false);

        YAxisValueFormatter custom = new DataAxisFormatter(format);
        YAxis leftAxis = mChart.getAxisLeft();
        YAxis rightAxis = mChart.getAxisRight();

        leftAxis.setValueFormatter(custom);
        rightAxis.setValueFormatter(custom);

        mChart.setData(data);
    }
 
开发者ID:bertrandmartel,项目名称:rfdroid-scanparam,代码行数:39,代码来源:BtDevicesActivity.java


示例2: setValueFormatter

import com.github.mikephil.charting.formatter.YAxisValueFormatter; //导入依赖的package包/类
/**
 * Sets the formatter to be used for formatting the axis labels. If no formatter is set, the chart will
 * automatically determine a reasonable formatting (concerning decimals) for all the values that are drawn inside
 * the chart. Use chart.getDefaultValueFormatter() to use the formatter calculated by the chart.
 *
 * @param f
 */
public void setValueFormatter(YAxisValueFormatter f) {

    if (f == null)
        mYAxisValueFormatter = new DefaultYAxisValueFormatter(mDecimals);
    else
        mYAxisValueFormatter = f;
}
 
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:15,代码来源:YAxis.java


示例3: setValueFormatter

import com.github.mikephil.charting.formatter.YAxisValueFormatter; //导入依赖的package包/类
/**
 * Sets the formatter to be used for formatting the axis labels. If no formatter is set, the chart will
 * automatically determine a reasonable formatting (concerning decimals) for all the values that are drawn inside
 * the chart. Use chart.getDefaultValueFormatter() to use the formatter calculated by the chart.
 *
 * @param f
 */
public void setValueFormatter(YAxisValueFormatter f) {

	if (f == null)
		mYAxisValueFormatter = new DefaultYAxisValueFormatter(mDecimals);
	else
		mYAxisValueFormatter = f;
}
 
开发者ID:xinpengfei520,项目名称:P2P,代码行数:15,代码来源:YAxis.java


示例4: setData

import com.github.mikephil.charting.formatter.YAxisValueFormatter; //导入依赖的package包/类
private void setData(List<Integer> valueList, String format) {

        mChart.setVisibility(View.VISIBLE);

        ArrayList<String> xVals = new ArrayList<String>();
        ArrayList<BarEntry> yVals1 = new ArrayList<BarEntry>();

        if (valueList != null) {
            for (int i = 0; i < valueList.size(); i++) {
                xVals.add(i + "s");
                yVals1.add(new BarEntry(valueList.get(i), i));
            }
        }

        String legend = getResources().getString(R.string.caption_receptin_rate);

        if (!format.equals("%"))
            legend = getResources().getString(R.string.caption_packet_count);

        BarDataSet set1 = new BarDataSet(yVals1, legend);
        set1.setBarSpacePercent(35f);
        set1.setColor(Color.parseColor("#0288D1"));

        ArrayList<IBarDataSet> dataSets = new ArrayList<IBarDataSet>();
        dataSets.add(set1);

        BarData data = new BarData(xVals, dataSets);
        data.setValueTextSize(10f);

        data.setDrawValues(false);

        YAxisValueFormatter custom = new DataAxisFormatter(format);
        YAxis leftAxis = mChart.getAxisLeft();
        YAxis rightAxis = mChart.getAxisRight();

        leftAxis.setValueFormatter(custom);
        rightAxis.setValueFormatter(custom);

        mChart.setData(data);
    }
 
开发者ID:bertrandmartel,项目名称:bluetooth-le-analyzer,代码行数:41,代码来源:RFdroidActivity.java


示例5: initChart

import com.github.mikephil.charting.formatter.YAxisValueFormatter; //导入依赖的package包/类
/**
 * initiliaze chart
 */
private void initChart() {
    mChart = (BarChart) findViewById(R.id.chart1);
    mChart.setDrawBarShadow(false);
    mChart.setDrawValueAboveBar(true);
    mChart.setDescription("");
    // if more than 60 entries are displayed in the chart, no values will be
    // drawn
    mChart.setMaxVisibleValueCount(60);
    // scaling can now only be done on x- and y-axis separately
    mChart.setPinchZoom(false);
    mChart.setDrawGridBackground(false);
    mChart.setDescriptionColor(Color.parseColor("#000000"));

    XAxis xAxis = mChart.getXAxis();
    xAxis.setDrawGridLines(false);
    xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
    xAxis.setSpaceBetweenLabels(0);

    YAxisValueFormatter custom = new DataAxisFormatter("%");

    YAxis leftAxis = mChart.getAxisLeft();
    leftAxis.setValueFormatter(custom);
    leftAxis.setPosition(YAxis.YAxisLabelPosition.OUTSIDE_CHART);

    YAxis rightAxis = mChart.getAxisRight();
    rightAxis.setValueFormatter(custom);
    rightAxis.setPosition(YAxis.YAxisLabelPosition.OUTSIDE_CHART);

    leftAxis.setDrawGridLines(true);
    rightAxis.setDrawGridLines(false);

    mChart.animateY(1000);

    mChart.getLegend().setEnabled(true);

    mChart.setVisibility(View.GONE);
}
 
开发者ID:bertrandmartel,项目名称:bluetooth-le-analyzer,代码行数:41,代码来源:AnalyzerActivity.java


示例6: setData

import com.github.mikephil.charting.formatter.YAxisValueFormatter; //导入依赖的package包/类
/**
 * update data for visualization chart
 *
 * @param valueList list of values for the chart
 * @param unit      data unit
 */
private void setData(List<Integer> valueList, String unit) {

    mChart.setVisibility(View.VISIBLE);

    ArrayList<String> xVals = new ArrayList<String>();
    ArrayList<BarEntry> yVals1 = new ArrayList<BarEntry>();

    for (int i = 0; i < valueList.size(); i++) {
        xVals.add(i + "s");
        yVals1.add(new BarEntry(valueList.get(i), i));
    }

    String legend = getResources().getString(R.string.caption_receptin_rate);

    if (!unit.equals("%"))
        legend = getResources().getString(R.string.caption_packet_count);

    BarDataSet set1 = new BarDataSet(yVals1, legend);
    set1.setBarSpacePercent(35f);
    set1.setColor(Color.parseColor("#0288D1"));

    ArrayList<IBarDataSet> dataSets = new ArrayList<IBarDataSet>();
    dataSets.add(set1);

    BarData data = new BarData(xVals, dataSets);
    data.setValueTextSize(10f);

    data.setDrawValues(false);

    YAxisValueFormatter custom = new DataAxisFormatter(unit);
    YAxis leftAxis = mChart.getAxisLeft();
    YAxis rightAxis = mChart.getAxisRight();

    leftAxis.setValueFormatter(custom);
    rightAxis.setValueFormatter(custom);

    mChart.setData(data);
}
 
开发者ID:bertrandmartel,项目名称:bluetooth-le-analyzer,代码行数:45,代码来源:AnalyzerActivity.java


示例7: setupChart

import com.github.mikephil.charting.formatter.YAxisValueFormatter; //导入依赖的package包/类
private void setupChart() {
    mChart.setDrawBarShadow(false);
    mChart.setDrawValueAboveBar(true);
    mChart.setDescription("");
    mChart.setMaxVisibleValueCount(60);
    mChart.setPinchZoom(false);
    mChart.setDrawGridBackground(false);

    XAxis xAxis = mChart.getXAxis();
    xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
    xAxis.setDrawGridLines(false);
    xAxis.setSpaceBetweenLabels(2);

    YAxisValueFormatter custom = new PercentFormatter();

    YAxis leftAxis = mChart.getAxisLeft();
    leftAxis.setLabelCount(8, false);
    leftAxis.setValueFormatter(custom);
    leftAxis.setPosition(YAxis.YAxisLabelPosition.OUTSIDE_CHART);
    leftAxis.setSpaceTop(15f);
    leftAxis.setAxisMinValue(0f);

    YAxis rightAxis = mChart.getAxisRight();
    rightAxis.setDrawGridLines(false);
    rightAxis.setLabelCount(8, false);
    rightAxis.setValueFormatter(custom);
    rightAxis.setSpaceTop(15f);
    rightAxis.setAxisMinValue(0f);

    Legend legend = mChart.getLegend();
    legend.setPosition(Legend.LegendPosition.BELOW_CHART_LEFT);
    legend.setForm(Legend.LegendForm.CIRCLE);
    legend.setFormSize(9f);
    legend.setTextSize(11f);
    legend.setXEntrySpace(4f);

    mChart.animateXY(1000, 1000);
}
 
开发者ID:andela-kogunde,项目名称:iWorkout,代码行数:39,代码来源:AnalyticsManager.java


示例8: onCreate

import com.github.mikephil.charting.formatter.YAxisValueFormatter; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.activity_barchart);

    tvX = (TextView) findViewById(R.id.tvXMax);
    tvY = (TextView) findViewById(R.id.tvYMax);

    mSeekBarX = (SeekBar) findViewById(R.id.seekBar1);
    mSeekBarY = (SeekBar) findViewById(R.id.seekBar2);

    mChart = (BarChart) findViewById(R.id.chart1);
    mChart.setOnChartValueSelectedListener(this);

    mChart.setDrawBarShadow(false);
    mChart.setDrawValueAboveBar(true);

    mChart.setDescription("");

    // if more than 60 entries are displayed in the chart, no values will be
    // drawn
    mChart.setMaxVisibleValueCount(60);

    // scaling can now only be done on x- and y-axis separately
    mChart.setPinchZoom(false);

    mChart.setDrawGridBackground(false);
    // mChart.setDrawYLabels(false);

    mTf = Typeface.createFromAsset(getAssets(), "OpenSans-Regular.ttf");

    XAxis xAxis = mChart.getXAxis();
    xAxis.setPosition(XAxisPosition.BOTTOM);
    xAxis.setTypeface(mTf);
    xAxis.setDrawGridLines(false);
    xAxis.setSpaceBetweenLabels(2);

    YAxisValueFormatter custom = new MyYAxisValueFormatter();

    YAxis leftAxis = mChart.getAxisLeft();
    leftAxis.setTypeface(mTf);
    leftAxis.setLabelCount(8, false);
    leftAxis.setValueFormatter(custom);
    leftAxis.setPosition(YAxisLabelPosition.OUTSIDE_CHART);
    leftAxis.setSpaceTop(15f);
    leftAxis.setAxisMinValue(0f); // this replaces setStartAtZero(true)

    YAxis rightAxis = mChart.getAxisRight();
    rightAxis.setDrawGridLines(false);
    rightAxis.setTypeface(mTf);
    rightAxis.setLabelCount(8, false);
    rightAxis.setValueFormatter(custom);
    rightAxis.setSpaceTop(15f);
    rightAxis.setAxisMinValue(0f); // this replaces setStartAtZero(true)

    Legend l = mChart.getLegend();
    l.setPosition(LegendPosition.BELOW_CHART_LEFT);
    l.setForm(LegendForm.SQUARE);
    l.setFormSize(9f);
    l.setTextSize(11f);
    l.setXEntrySpace(4f);
    // l.setExtra(ColorTemplate.VORDIPLOM_COLORS, new String[] { "abc",
    // "def", "ghj", "ikl", "mno" });
    // l.setCustom(ColorTemplate.VORDIPLOM_COLORS, new String[] { "abc",
    // "def", "ghj", "ikl", "mno" });

    setData(12, 50);

    // setting data
    mSeekBarY.setProgress(50);
    mSeekBarX.setProgress(12);

    mSeekBarY.setOnSeekBarChangeListener(this);
    mSeekBarX.setOnSeekBarChangeListener(this);

    // mChart.setDrawLegend(false);
}
 
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:80,代码来源:BarChartActivity.java


示例9: setValueFormatter

import com.github.mikephil.charting.formatter.YAxisValueFormatter; //导入依赖的package包/类
/**
 * Sets the formatter to be used for formatting the axis labels. If no formatter is set, the
 * chart will
 * automatically determine a reasonable formatting (concerning decimals) for all the values
 * that are drawn inside
 * the chart. Use chart.getDefaultValueFormatter() to use the formatter calculated by the chart.
 *
 * @param f
 */
public void setValueFormatter(YAxisValueFormatter f) {

    if (f == null)
        mYAxisValueFormatter = new DefaultYAxisValueFormatter(mDecimals);
    else
        mYAxisValueFormatter = f;
}
 
开发者ID:pencil-box,项目名称:NetKnight,代码行数:17,代码来源:YAxis.java



注:本文中的com.github.mikephil.charting.formatter.YAxisValueFormatter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java LangDetectException类代码示例发布时间:2022-05-21
下一篇:
Java SupportFragmentTestUtil类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap