本文整理匯總了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;
}
示例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));
}
示例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));
}
}
示例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;
}