当前位置: 首页>>代码示例>>Java>>正文


Java BarChart.setNoDataText方法代码示例

本文整理汇总了Java中com.github.mikephil.charting.charts.BarChart.setNoDataText方法的典型用法代码示例。如果您正苦于以下问题:Java BarChart.setNoDataText方法的具体用法?Java BarChart.setNoDataText怎么用?Java BarChart.setNoDataText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.github.mikephil.charting.charts.BarChart的用法示例。


在下文中一共展示了BarChart.setNoDataText方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreateView

import com.github.mikephil.charting.charts.BarChart; //导入方法依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.suite_fragment, container, false);

    mChart = (BarChart) v.findViewById(R.id.chart);
    mChart.setNoDataText(null);
    mChart.setNoDataTextColor(0xFF000000);
    mChart.setFitBars(true);

    return v;
}
 
开发者ID:jasonwyatt,项目名称:SQLite-Performance,代码行数:13,代码来源:TestSuiteFragment.java

示例2: initChart

import com.github.mikephil.charting.charts.BarChart; //导入方法依赖的package包/类
private void initChart(BarChart chart) {
    float scaledDensity = getResources().getDisplayMetrics().scaledDensity;
    chart.setDragEnabled(true);
    chart.setScaleYEnabled(false);
    chart.setScaleXEnabled(false);
    chart.setDoubleTapToZoomEnabled(false);
    chart.setPinchZoom(false);
    chart.setHighlightPerDragEnabled(false);
    chart.setHighlightPerTapEnabled(false);

    chart.setDrawGridBackground(false);
    chart.setDrawBorders(false);
    chart.setDrawValueAboveBar(false);
    chart.getAxisLeft().setEnabled(false);
    XAxis xAxis = chart.getXAxis();
    xAxis.setDrawAxisLine(true);
    xAxis.setDrawGridLines(false);
    xAxis.setDrawLabels(false);
    xAxis.setDrawLimitLinesBehindData(false);
    xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);

    YAxis yAxis = chart.getAxisRight();
    yAxis.setDrawAxisLine(false);
    yAxis.setStartAtZero(false);
    yAxis.setSpaceTop(10f);
    yAxis.setSpaceBottom(0f);
    yAxis.setTextSize(10 * scaledDensity);
    yAxis.setTextColor(ContextCompat.getColor(this, R.color.text));
    chart.getLegend().setEnabled(false);
    chart.setDescription(" ");

    chart.setNoDataText("Can't see sh*t captain!");
    Paint p = chart.getPaint(Chart.PAINT_INFO);
    DisplayMetrics dm = getResources().getDisplayMetrics();
    int size = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 18, dm); //TODO use styles
    p.setTextSize(size);
    p.setColor(ContextCompat.getColor(this, R.color.gray600));
    p.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
}
 
开发者ID:stanleyguevara,项目名称:beaconradar,代码行数:40,代码来源:DetailsActivity.java

示例3: onCreate

import com.github.mikephil.charting.charts.BarChart; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    AndroidInjection.inject(this);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_chart);
    if (getActionBar() != null) {
        getActionBar().setDisplayHomeAsUpEnabled(true);
    }

    final BarChart chart = findViewById(R.id.barChart);
    chart.setDescription("");

    if (getIntent() != null) {
        final DateTime startDate = (DateTime) getIntent().getSerializableExtra(START_DATE);
        final DateTime endDate = (DateTime) getIntent().getSerializableExtra(END_DATE);

        chart.setNoDataText(getString(R.string.chart_loading_data));

        Observable.create(new Observable.OnSubscribe<BarData>() {
            @Override
            public void call(Subscriber<? super BarData> subscriber) {
                subscriber.onNext(loadData(startDate, endDate));
            }
        })
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Subscriber<BarData>() {
                    @Override
                    public void onCompleted() {
                    }

                    @Override
                    public void onError(Throwable e) {
                        chart.setNoDataText(getString(R.string.chart_error_loading));
                    }

                    @Override
                    public void onNext(BarData barData) {
                        chart.setData(barData);
                        chart.invalidate();
                        onCompleted();
                    }
                });
    } else {
        chart.setNoDataText(getString(R.string.chart_no_data));
    }
}
 
开发者ID:dbaelz,项目名称:OnOff-Tracker,代码行数:48,代码来源:ChartActivity.java

示例4: onCreateView

import com.github.mikephil.charting.charts.BarChart; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.charts_fragment, container, false);

    TextView month = (TextView) v.findViewById(R.id.current_month);
    long ts = getArguments().getLong(DB.TIMESTAMP);
    month.setText(SDF_MONTH.format(new Date(ts * 1000)));

    // отображение статистики за текущий месяц
    BarChart barChart = (BarChart) v.findViewById(R.id.bar_chart);
    barChart.setDescription("");

    Paint mInfoPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mInfoPaint.setColor(getResources().getColor(R.color.primary));
    mInfoPaint.setTextAlign(Paint.Align.CENTER);
    mInfoPaint.setTextSize(com.github.mikephil.charting.utils.Utils.convertDpToPixel(16f));
    barChart.setPaint(mInfoPaint, Chart.PAINT_INFO);
    barChart.setNoDataText(getString(R.string.charts_no_data));

    barChart.setDrawBarShadow(false);
    barChart.setDrawGridBackground(false);
    barChart.setDrawValueAboveBar(false);

    barChart.setPinchZoom(false);
    barChart.setScaleEnabled(false);
    barChart.setDoubleTapToZoomEnabled(false);

    barChart.getXAxis().disableGridDashedLine();
    barChart.getXAxis().setDrawGridLines(false);
    barChart.getXAxis().setEnabled(false);

    barChart.getAxisLeft().setDrawGridLines(false);
    barChart.getAxisLeft().setEnabled(false);

    barChart.getAxisRight().setDrawGridLines(false);
    barChart.getAxisRight().removeAllLimitLines();
    barChart.getAxisRight().setValueFormatter(new FinanceFormatter());

    barChart.getLegend().setEnabled(false);
    barChart.setData(generateMonthlyData());
    // если данных нет, не показывать ось
    barChart.getAxisRight().setEnabled(!barChart.isEmpty());

    MyMarkerView mv = new MyMarkerView(getActivity(), R.layout.custom_marker_view);
    mv.setX(mv.getMeasuredWidth());
    barChart.setMarkerView(mv);


    Utils.log("getYMin = " + barChart.getBarData().getYMin());
    Utils.log("getYMax = " + barChart.getBarData().getYMax());

    barChart.animateY(ANIMATION_TIME);
    return v;
}
 
开发者ID:Sash0k,项目名称:Thrift-box,代码行数:55,代码来源:ChartsFragment.java


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