Java Code Examples for com.github.mikephil.charting.components.YAxis#setDrawZeroLine()
The following examples show how to use
com.github.mikephil.charting.components.YAxis#setDrawZeroLine() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestSuiteFragment.java From SQLite-Performance with The Unlicense | 5 votes |
private void setupYAxes(BarLineChartBase chart) { YAxis y = chart.getAxisLeft(); y.setDrawZeroLine(true); y.setDrawLabels(false); y.setDrawGridLines(false); y.setDrawAxisLine(false); y.setAxisMinimum(0); y = chart.getAxisRight(); y.setDrawZeroLine(true); y.setDrawLabels(false); y.setDrawGridLines(false); y.setDrawAxisLine(false); y.setAxisMinimum(0); }
Example 2
Source File: FilledLineActivity.java From StockChart-MPAndroidChart with MIT License | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.activity_linechart_noseekbar); setTitle("FilledLineActivity"); chart = findViewById(R.id.chart1); chart.setBackgroundColor(Color.WHITE); chart.setGridBackgroundColor(fillColor); chart.setDrawGridBackground(true); chart.setDrawBorders(true); // no description text chart.getDescription().setEnabled(false); // if disabled, scaling can be done on x- and y-axis separately chart.setPinchZoom(false); Legend l = chart.getLegend(); l.setEnabled(false); XAxis xAxis = chart.getXAxis(); xAxis.setEnabled(false); YAxis leftAxis = chart.getAxisLeft(); leftAxis.setAxisMaximum(900f); leftAxis.setAxisMinimum(-250f); leftAxis.setDrawAxisLine(false); leftAxis.setDrawZeroLine(false); leftAxis.setDrawGridLines(false); chart.getAxisRight().setEnabled(false); // add data setData(100, 60); chart.invalidate(); }
Example 3
Source File: BubbleChartActivity.java From StockChart-MPAndroidChart with MIT License | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.activity_bubblechart); setTitle("BubbleChartActivity"); tvX = findViewById(R.id.tvXMax); tvY = findViewById(R.id.tvYMax); seekBarX = findViewById(R.id.seekBar1); seekBarX.setOnSeekBarChangeListener(this); seekBarY = findViewById(R.id.seekBar2); seekBarY.setOnSeekBarChangeListener(this); chart = findViewById(R.id.chart1); chart.getDescription().setEnabled(false); chart.setOnChartValueSelectedListener(this); chart.setDrawGridBackground(false); chart.setTouchEnabled(true); // enable scaling and dragging chart.setDragEnabled(true); chart.setScaleEnabled(true); chart.setMaxVisibleValueCount(200); chart.setPinchZoom(true); seekBarX.setProgress(10); seekBarY.setProgress(50); Legend l = chart.getLegend(); l.setVerticalAlignment(Legend.LegendVerticalAlignment.TOP); l.setHorizontalAlignment(Legend.LegendHorizontalAlignment.RIGHT); l.setOrientation(Legend.LegendOrientation.VERTICAL); l.setDrawInside(false); l.setTypeface(tfLight); YAxis yl = chart.getAxisLeft(); yl.setTypeface(tfLight); yl.setSpaceTop(30f); yl.setSpaceBottom(30f); yl.setDrawZeroLine(false); chart.getAxisRight().setEnabled(false); XAxis xl = chart.getXAxis(); xl.setPosition(XAxis.XAxisPosition.BOTTOM); xl.setTypeface(tfLight); }
Example 4
Source File: BarChartPositiveNegative.java From StockChart-MPAndroidChart with MIT License | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.activity_barchart_noseekbar); setTitle("BarChartPositiveNegative"); chart = findViewById(R.id.chart1); chart.setBackgroundColor(Color.WHITE); chart.setExtraTopOffset(-30f); chart.setExtraBottomOffset(10f); chart.setExtraLeftOffset(70f); chart.setExtraRightOffset(70f); chart.setDrawBarShadow(false); chart.setDrawValueAboveBar(true); chart.getDescription().setEnabled(false); // scaling can now only be done on x- and y-axis separately chart.setPinchZoom(false); chart.setDrawGridBackground(false); XAxis xAxis = chart.getXAxis(); xAxis.setPosition(XAxisPosition.BOTTOM); xAxis.setTypeface(tfRegular); xAxis.setDrawGridLines(false); xAxis.setDrawAxisLine(false); xAxis.setTextColor(Color.LTGRAY); xAxis.setTextSize(13f); xAxis.setLabelCount(5); xAxis.setCenterAxisLabels(true); xAxis.setGranularity(1f); YAxis left = chart.getAxisLeft(); 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); // THIS IS THE ORIGINAL DATA YOU WANT TO PLOT final List<Data> data = new ArrayList<>(); data.add(new Data(0f, -224.1f, "12-29")); data.add(new Data(1f, 238.5f, "12-30")); data.add(new Data(2f, 1280.1f, "12-31")); data.add(new Data(3f, -442.3f, "01-01")); data.add(new Data(4f, -2280.1f, "01-02")); xAxis.setValueFormatter(new ValueFormatter() { @Override public String getFormattedValue(float value) { return data.get(Math.min(Math.max((int) value, 0), data.size()-1)).xAxisValue; } }); setData(data); }
Example 5
Source File: LineChartActivity2.java From StockChart-MPAndroidChart with MIT License | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.activity_linechart); setTitle("LineChartActivity2"); tvX = findViewById(R.id.tvXMax); tvY = findViewById(R.id.tvYMax); seekBarX = findViewById(R.id.seekBar1); seekBarX.setOnSeekBarChangeListener(this); seekBarY = findViewById(R.id.seekBar2); seekBarY.setOnSeekBarChangeListener(this); chart = findViewById(R.id.chart1); chart.setOnChartValueSelectedListener(this); // no description text chart.getDescription().setEnabled(false); // enable touch gestures chart.setTouchEnabled(true); chart.setDragDecelerationFrictionCoef(0.9f); // enable scaling and dragging chart.setDragEnabled(true); chart.setScaleEnabled(true); chart.setDrawGridBackground(false); chart.setHighlightPerDragEnabled(true); // if disabled, scaling can be done on x- and y-axis separately chart.setPinchZoom(true); // set an alternative background color chart.setBackgroundColor(Color.LTGRAY); // add data seekBarX.setProgress(20); seekBarY.setProgress(30); chart.animateX(1500); // get the legend (only possible after setting data) Legend l = chart.getLegend(); // modify the legend ... l.setForm(LegendForm.LINE); l.setTypeface(tfLight); l.setTextSize(11f); l.setTextColor(Color.WHITE); l.setVerticalAlignment(Legend.LegendVerticalAlignment.BOTTOM); l.setHorizontalAlignment(Legend.LegendHorizontalAlignment.LEFT); l.setOrientation(Legend.LegendOrientation.HORIZONTAL); l.setDrawInside(false); // l.setYOffset(11f); XAxis xAxis = chart.getXAxis(); xAxis.setTypeface(tfLight); xAxis.setTextSize(11f); xAxis.setTextColor(Color.WHITE); xAxis.setDrawGridLines(false); xAxis.setDrawAxisLine(false); YAxis leftAxis = chart.getAxisLeft(); leftAxis.setTypeface(tfLight); leftAxis.setTextColor(ColorTemplate.getHoloBlue()); leftAxis.setAxisMaximum(200f); leftAxis.setAxisMinimum(0f); leftAxis.setDrawGridLines(true); leftAxis.setGranularityEnabled(true); YAxis rightAxis = chart.getAxisRight(); rightAxis.setTypeface(tfLight); rightAxis.setTextColor(Color.RED); rightAxis.setAxisMaximum(900); rightAxis.setAxisMinimum(-200); rightAxis.setDrawGridLines(false); rightAxis.setDrawZeroLine(false); rightAxis.setGranularityEnabled(false); }
Example 6
Source File: BubbleChartActivity.java From Stayfit with Apache License 2.0 | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.activity_bubblechart); tvX = (TextView) findViewById(R.id.tvXMax); tvY = (TextView) findViewById(R.id.tvYMax); mSeekBarX = (SeekBar) findViewById(R.id.seekBar1); mSeekBarX.setOnSeekBarChangeListener(this); mSeekBarY = (SeekBar) findViewById(R.id.seekBar2); mSeekBarY.setOnSeekBarChangeListener(this); mChart = (BubbleChart) findViewById(R.id.chart1); mChart.setDescription(""); tf = Typeface.createFromAsset(getAssets(), "OpenSans-Regular.ttf"); mChart.setOnChartValueSelectedListener(this); mChart.setDrawGridBackground(false); mChart.setTouchEnabled(true); // enable scaling and dragging mChart.setDragEnabled(true); mChart.setScaleEnabled(true); mChart.setMaxVisibleValueCount(200); mChart.setPinchZoom(true); mSeekBarX.setProgress(5); mSeekBarY.setProgress(50); Legend l = mChart.getLegend(); l.setPosition(LegendPosition.RIGHT_OF_CHART); l.setTypeface(tf); YAxis yl = mChart.getAxisLeft(); yl.setTypeface(tf); yl.setSpaceTop(30f); yl.setSpaceBottom(30f); yl.setDrawZeroLine(false); mChart.getAxisRight().setEnabled(false); XAxis xl = mChart.getXAxis(); xl.setPosition(XAxis.XAxisPosition.BOTTOM); xl.setTypeface(tf); }
Example 7
Source File: BarChartPositiveNegative.java From Stayfit with Apache License 2.0 | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.activity_barchart_noseekbar); mTf = Typeface.createFromAsset(getAssets(), "OpenSans-Regular.ttf"); mChart = (BarChart) findViewById(R.id.chart1); mChart.setBackgroundColor(Color.WHITE); mChart.setExtraTopOffset(-30f); mChart.setExtraBottomOffset(10f); mChart.setExtraLeftOffset(70f); mChart.setExtraRightOffset(70f); mChart.setDrawBarShadow(false); mChart.setDrawValueAboveBar(true); mChart.setDescription(""); // scaling can now only be done on x- and y-axis separately mChart.setPinchZoom(false); mChart.setDrawGridBackground(false); XAxis xAxis = mChart.getXAxis(); xAxis.setPosition(XAxisPosition.BOTTOM); xAxis.setTypeface(mTf); xAxis.setDrawGridLines(false); xAxis.setDrawAxisLine(false); xAxis.setSpaceBetweenLabels(2); xAxis.setTextColor(Color.LTGRAY); xAxis.setTextSize(13f); YAxis left = mChart.getAxisLeft(); left.setDrawLabels(false); left.setStartAtZero(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); mChart.getAxisRight().setEnabled(false); mChart.getLegend().setEnabled(false); // THIS IS THE ORIGINAL DATA YOU WANT TO PLOT List<Data> data = new ArrayList<>(); data.add(new Data(0, -224.1f, "12-29")); data.add(new Data(1, 238.5f, "12-30")); data.add(new Data(2, 1280.1f, "12-31")); data.add(new Data(3, -442.3f, "01-01")); data.add(new Data(4, -2280.1f, "01-02")); setData(data); }
Example 8
Source File: LineChartActivity2.java From Stayfit with Apache License 2.0 | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.activity_linechart); tvX = (TextView) findViewById(R.id.tvXMax); tvY = (TextView) findViewById(R.id.tvYMax); mSeekBarX = (SeekBar) findViewById(R.id.seekBar1); mSeekBarY = (SeekBar) findViewById(R.id.seekBar2); mSeekBarX.setProgress(45); mSeekBarY.setProgress(100); mSeekBarY.setOnSeekBarChangeListener(this); mSeekBarX.setOnSeekBarChangeListener(this); mChart = (LineChart) findViewById(R.id.chart1); mChart.setOnChartValueSelectedListener(this); // no description text mChart.setDescription(""); mChart.setNoDataTextDescription("You need to provide data for the chart."); // enable touch gestures mChart.setTouchEnabled(true); mChart.setDragDecelerationFrictionCoef(0.9f); // enable scaling and dragging mChart.setDragEnabled(true); mChart.setScaleEnabled(true); mChart.setDrawGridBackground(false); mChart.setHighlightPerDragEnabled(true); // if disabled, scaling can be done on x- and y-axis separately mChart.setPinchZoom(true); // set an alternative background color mChart.setBackgroundColor(Color.LTGRAY); // add data setData(20, 30); mChart.animateX(2500); Typeface tf = Typeface.createFromAsset(getAssets(), "OpenSans-Regular.ttf"); // get the legend (only possible after setting data) Legend l = mChart.getLegend(); // modify the legend ... // l.setPosition(LegendPosition.LEFT_OF_CHART); l.setForm(LegendForm.LINE); l.setTypeface(tf); l.setTextSize(11f); l.setTextColor(Color.WHITE); l.setPosition(LegendPosition.BELOW_CHART_LEFT); // l.setYOffset(11f); XAxis xAxis = mChart.getXAxis(); xAxis.setTypeface(tf); xAxis.setTextSize(12f); xAxis.setTextColor(Color.WHITE); xAxis.setDrawGridLines(false); xAxis.setDrawAxisLine(false); xAxis.setSpaceBetweenLabels(1); YAxis leftAxis = mChart.getAxisLeft(); leftAxis.setTypeface(tf); leftAxis.setTextColor(ColorTemplate.getHoloBlue()); leftAxis.setAxisMaxValue(200f); leftAxis.setAxisMinValue(0f); leftAxis.setDrawGridLines(true); YAxis rightAxis = mChart.getAxisRight(); rightAxis.setTypeface(tf); rightAxis.setTextColor(Color.RED); rightAxis.setAxisMaxValue(900); rightAxis.setAxisMinValue(-200); rightAxis.setDrawGridLines(false); rightAxis.setDrawZeroLine(false); }
Example 9
Source File: MiniDateGraph.java From fastnfitness with BSD 3-Clause "New" or "Revised" License | 4 votes |
public MiniDateGraph(Context context, LineChart chart, String name) { mChart = chart; mChartName = name; mChart.getDescription().setEnabled(false); mChart.setDoubleTapToZoomEnabled(false); mChart.setHorizontalScrollBarEnabled(false); mChart.setVerticalScrollBarEnabled(false); mChart.setAutoScaleMinMaxEnabled(false); mChart.setDrawBorders(false); mChart.setViewPortOffsets(6f, 6f, 6f, 6f); mChart.animateY(1000, Easing.EaseInOutBack); // animate horizontal 3000 milliseconds mChart.setClickable(false); mChart.getAxisRight().setDrawLabels(false); mChart.getAxisLeft().setDrawLabels(false); mChart.getLegend().setEnabled(false); mChart.setPinchZoom(false); mChart.setDescription(null); mChart.setTouchEnabled(false); mChart.setDoubleTapToZoomEnabled(false); mChart.setNoDataText(context.getString(R.string.no_chart_data_available)); mContext = context; // get the legend (only possible after setting data) Legend l = mChart.getLegend(); l.setEnabled(false); XAxis xAxis = mChart.getXAxis(); xAxis.setDrawLabels(false); xAxis.setPosition(XAxis.XAxisPosition.BOTTOM); xAxis.setTextColor(ColorTemplate.getHoloBlue()); xAxis.setDrawAxisLine(false); xAxis.setDrawGridLines(false); xAxis.setCenterAxisLabels(false); xAxis.setGranularity(1); // 1 jour YAxis leftAxis = mChart.getAxisLeft(); leftAxis.setEnabled(false); leftAxis.setDrawZeroLine(false); leftAxis.setDrawLabels(false); leftAxis.setPosition(YAxis.YAxisLabelPosition.OUTSIDE_CHART); leftAxis.setTextColor(ColorTemplate.getHoloBlue()); leftAxis.setDrawGridLines(false); leftAxis.setGranularityEnabled(false); mChart.getAxisRight().setEnabled(false); }
Example 10
Source File: YAxisChartBase.java From react-native-mp-android-chart with MIT License | 4 votes |
protected void setYAxisConfig(YAxis axis, ReadableMap propMap) { if (BridgeUtils.validate(propMap, ReadableType.Number, "axisMaxValue")) { axis.setAxisMaxValue((float) propMap.getDouble("axisMaxValue")); } if (BridgeUtils.validate(propMap, ReadableType.Number, "axisMinValue")) { axis.setAxisMinValue((float) propMap.getDouble("axisMinValue")); } if (BridgeUtils.validate(propMap, ReadableType.Boolean, "inverted")) { axis.setInverted(propMap.getBoolean("inverted")); } if (BridgeUtils.validate(propMap, ReadableType.Number, "spaceTop")) { axis.setSpaceTop((float) propMap.getDouble("spaceTop")); } if (BridgeUtils.validate(propMap, ReadableType.Number, "spaceBottom")) { axis.setSpaceBottom((float) propMap.getDouble("spaceBottom")); } if (BridgeUtils.validate(propMap, ReadableType.Boolean, "showOnlyMinMax")) { axis.setShowOnlyMinMax(propMap.getBoolean("showOnlyMinMax")); } if (BridgeUtils.validate(propMap, ReadableType.Number, "labelCount")) { boolean labelCountForce = false; if (BridgeUtils.validate(propMap, ReadableType.Boolean, "labelCountForce")) { labelCountForce = propMap.getBoolean("labelCountForce"); } axis.setLabelCount(propMap.getInt("labelCount"), labelCountForce); } if (BridgeUtils.validate(propMap, ReadableType.String, "position")) { axis.setPosition(YAxis.YAxisLabelPosition.valueOf(propMap.getString("position"))); } if (BridgeUtils.validate(propMap, ReadableType.Number, "granularity")) { axis.setGranularity((float) propMap.getDouble("granularity")); } if (BridgeUtils.validate(propMap, ReadableType.Boolean, "granularityEnabled")) { axis.setGranularityEnabled(propMap.getBoolean("granularityEnabled")); } // formatting if (BridgeUtils.validate(propMap, ReadableType.String, "valueFormatter")) { String valueFormatter = propMap.getString("valueFormatter"); if ("largeValue".equals(valueFormatter)) { axis.setValueFormatter(new LargeValueFormatter()); } else if ("percent".equals(valueFormatter)) { axis.setValueFormatter(new PercentFormatter()); } else { axis.setValueFormatter(new CustomFormatter(valueFormatter)); } } // TODO docs says the remaining config needs to be applied before setting data. Test it // zero line if (BridgeUtils.validate(propMap, ReadableType.Map, "zeroLine")) { ReadableMap zeroLineConfig = propMap.getMap("zeroLine"); if (BridgeUtils.validate(zeroLineConfig, ReadableType.Boolean, "enabled")) { axis.setDrawZeroLine(zeroLineConfig.getBoolean("enabled")); } if (BridgeUtils.validate(zeroLineConfig, ReadableType.Number, "lineWidth")) { axis.setZeroLineWidth((float) zeroLineConfig.getDouble("lineWidth")); } if (BridgeUtils.validate(zeroLineConfig, ReadableType.String, "lineColor")) { axis.setZeroLineColor(Color.parseColor(zeroLineConfig.getString("lineColor"))); } } }
Example 11
Source File: LineChartCard.java From ResearchStack with Apache License 2.0 | 4 votes |
private void initializeViews() { titleTextView = (TextView) findViewById(R.id.view_chart_line_title); titleTextView.setText(titleText); titleTextView.setTextColor(titleTextColor); titleTextView.setTextSize(TypedValue.COMPLEX_UNIT_PX, titleTextSize); titleTextView.setTypeface(Typeface.create(titleTextTypeface, Typeface.NORMAL)); expand = (ImageView) findViewById(R.id.view_chart_line_expand); if (expandTintColor != 0) { Drawable drawable = expand.getDrawable(); drawable = DrawableCompat.wrap(drawable); DrawableCompat.setTint(drawable, expandTintColor); expand.setImageDrawable(drawable); } chart = (LineChart) findViewById(R.id.view_chart_line); chart.getLegend().setEnabled(false); chart.setDescription(""); chart.setDrawBorders(false); chart.setDrawGridBackground(false); chart.setPinchZoom(false); chart.setTouchEnabled(true); chart.setDragEnabled(true); chart.setExtraLeftOffset(0); chart.setExtraBottomOffset(8); chart.setExtraTopOffset(0); XAxis xAxis = chart.getXAxis(); xAxis.setPosition(XAxis.XAxisPosition.BOTTOM); xAxis.setDrawAxisLine(false); xAxis.setDrawGridLines(false); xAxis.setLabelsToSkip(0); xAxis.setXOffset(16); xAxis.setTextSize(chartXAxisTextSize); xAxis.setTextColor(chartXAxisTextColor); xAxis.setTypeface(Typeface.create(chartXAxisTextTypeface, Typeface.NORMAL)); YAxis yAxisLeft = chart.getAxisLeft(); yAxisLeft.setDrawAxisLine(false); yAxisLeft.setDrawGridLines(false); yAxisLeft.setDrawZeroLine(false); yAxisLeft.setDrawLabels(true); yAxisLeft.setShowOnlyMinMax(true); yAxisLeft.setXOffset(16); yAxisLeft.setTextSize(chartYAxisTextSize); yAxisLeft.setTextColor(chartYAxisTextColor); yAxisLeft.setTypeface(Typeface.create(chartYAxisTextTypeface, Typeface.NORMAL)); YAxis yAxisRight = chart.getAxisRight(); yAxisRight.setDrawAxisLine(false); yAxisRight.setDrawGridLines(false); yAxisRight.setDrawZeroLine(false); yAxisRight.setDrawLabels(false); yAxisRight.setSpaceTop(0); }
Example 12
Source File: BarChartCard.java From ResearchStack with Apache License 2.0 | 4 votes |
private void initializeViews() { titleTextView = (TextView) findViewById(R.id.view_chart_bar_title); titleTextView.setText(titleText); titleTextView.setTextColor(titleTextColor); titleTextView.setTextSize(TypedValue.COMPLEX_UNIT_PX, titleTextSize); titleTextView.setTypeface(Typeface.create(titleTextTypeface, Typeface.NORMAL)); expand = (ImageView) findViewById(R.id.view_chart_line_expand); if (expandTintColor != 0) { Drawable drawable = expand.getDrawable(); drawable = DrawableCompat.wrap(drawable); DrawableCompat.setTint(drawable, expandTintColor); expand.setImageDrawable(drawable); } chart = (BarChart) findViewById(R.id.view_chart_bar); chart.getLegend().setEnabled(false); chart.setDescription(""); chart.setDrawBorders(false); chart.setDrawValueAboveBar(false); chart.setDrawGridBackground(false); chart.setDrawBarShadow(false); chart.setDrawHighlightArrow(false); chart.setPinchZoom(false); chart.setExtraLeftOffset(0); chart.setExtraRightOffset(0); chart.setExtraBottomOffset(8); chart.setExtraTopOffset(0); chart.setTouchEnabled(true); chart.setDragEnabled(true); XAxis xAxis = chart.getXAxis(); xAxis.setPosition(XAxis.XAxisPosition.BOTTOM); xAxis.setDrawAxisLine(false); xAxis.setYOffset(16); xAxis.setDrawGridLines(false); xAxis.setLabelsToSkip(0); xAxis.setTextSize(chartXAxisTextSize); xAxis.setTextColor(chartXAxisTextColor); xAxis.setTypeface(Typeface.create(chartXAxisTextTypeface, Typeface.NORMAL)); YAxis yAxisLeft = chart.getAxisLeft(); yAxisLeft.setDrawAxisLine(false); yAxisLeft.setDrawGridLines(false); yAxisLeft.setDrawZeroLine(false); yAxisLeft.setDrawLabels(false); YAxis yAxisRight = chart.getAxisRight(); yAxisRight.setDrawAxisLine(false); yAxisRight.setDrawGridLines(false); yAxisRight.setDrawZeroLine(false); yAxisRight.setDrawLabels(false); }