@Override public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.frag_simple_bar, container, false); // create a new chart object chart = new BarChart(getActivity()); chart.getDescription().setEnabled(false); chart.setOnChartGestureListener(this); MyMarkerView mv = new MyMarkerView(getActivity(), R.layout.custom_marker_view); mv.setChartView(chart); // For bounds control chart.setMarker(mv); chart.setDrawGridBackground(false); chart.setDrawBarShadow(false); Typeface tf = Typeface.createFromAsset(context.getAssets(), "OpenSans-Light.ttf"); chart.setData(generateBarData(1, 20000, 12)); Legend l = chart.getLegend(); l.setTypeface(tf); YAxis leftAxis = chart.getAxisLeft(); leftAxis.setTypeface(tf); leftAxis.setAxisMinimum(0f); // this replaces setStartAtZero(true) chart.getAxisRight().setEnabled(false); XAxis xAxis = chart.getXAxis(); xAxis.setEnabled(false); // programmatically add the chart FrameLayout parent = v.findViewById(R.id.parentLayout); parent.addView(chart); return v; }
leftAxis.setSpaceTop(15f); YAxis rightAxis = holder.chart.getAxisRight(); rightAxis.setTypeface(tfLight); rightAxis.setLabelCount(5, false);
leftAxis.setAxisMinimum(0f); // this replaces setStartAtZero(true) YAxis rightAxis = holder.chart.getAxisRight(); rightAxis.setTypeface(mTf); rightAxis.setLabelCount(5, false);
leftAxis.setValueFormatter(new MyValueFormatter("K")); leftAxis.setAxisMinimum(0f); // this replaces setStartAtZero(true) chart.getAxisRight().setEnabled(false);
leftAxis.setAxisMinimum(0f); // this replaces setStartAtZero(true) chart.getAxisRight().setEnabled(false);
left.setZeroLineColor(Color.GRAY); left.setZeroLineWidth(0.7f); chart.getAxisRight().setEnabled(false); chart.getLegend().setEnabled(false);
leftAxis.setAxisMinimum(0f); // this replaces setStartAtZero(true) YAxis rightAxis = chart.getAxisRight(); rightAxis.setDrawGridLines(false); rightAxis.setTypeface(tfLight);
leftAxis.setGranularity(0.1f); YAxis rightAxis = chart.getAxisRight(); rightAxis.setDrawGridLines(false); rightAxis.setTypeface(tfLight);
private void initChartBar(BarChart chart) { chart.setTouchEnabled(true); chart.setDrawGridBackground(true); chart.getAxisRight().setEnabled(false); chart.setDrawGridBackground(true); YAxis leftAxis = chart.getAxisLeft(); leftAxis.setAxisMaxValue(100F); leftAxis.setAxisMinValue(10F); leftAxis.setStartAtZero(false); leftAxis.setAxisLineWidth(2); leftAxis.setDrawGridLines(true); // X-Axis XAxis xAxis = chart.getXAxis(); xAxis.resetLabelsToSkip(); xAxis.setPosition(XAxis.XAxisPosition.BOTTOM); xAxis.setDrawGridLines(true); }
public BarChartManager(BarChart barChart) { this.barChart = barChart; leftAxis = this.barChart.getAxisLeft(); rightAxis = this.barChart.getAxisRight(); xAxis = this.barChart.getXAxis(); }
leftAxis.setSpaceTop(15f); YAxis rightAxis = holder.chart.getAxisRight(); rightAxis.setTypeface(mTfLight); rightAxis.setLabelCount(5, false);
leftAxis.setAxisMinimum(0f); // this replaces setStartAtZero(true) YAxis rightAxis = holder.chart.getAxisRight(); rightAxis.setTypeface(mTf); rightAxis.setLabelCount(5, false);
leftAxis.setAxisMinimum(0f); // this replaces setStartAtZero(true) mChart.getAxisRight().setEnabled(false);
left.setZeroLineColor(Color.GRAY); left.setZeroLineWidth(0.7f); mChart.getAxisRight().setEnabled(false); mChart.getLegend().setEnabled(false);
leftAxis.setValueFormatter(new MyAxisValueFormatter()); leftAxis.setAxisMinimum(0f); // this replaces setStartAtZero(true) mChart.getAxisRight().setEnabled(false);
YAxis rightAxis = chart.getAxisRight(); rightAxis.setDrawAxisLine(false); // 右侧坐标轴线 rightAxis.setDrawLabels(false); // 右侧坐标轴数组Label
leftAxis.setAxisMinimum(0f); // this replaces setStartAtZero(true) mChart.getAxisRight().setEnabled(false);
leftAxis.setGranularity(0.1f); YAxis rightAxis = mChart.getAxisRight(); rightAxis.setDrawGridLines(false); rightAxis.setTypeface(mTfLight);
YAxis yAxisRight = barChart.getAxisRight(); yAxisRight.setEnabled(false); YAxis yAxisLeft = barChart.getAxisLeft();
leftAxis.setDrawAxisLine(false);//禁止绘制y轴 barChart.getAxisRight().setEnabled(false);//禁用右侧y轴