Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android mp android chart set type face for XAxisLeft

I have a line chart using the library MPAndroidChart

    mChart.setData(data);
                        mChart.getAxisLeft().setTypeface(MyApplication.giloryItaly);
                        mChart.invalidate();

                        mChart.getXAxis().setTypeface(MyApplication.giloryItaly);
                        mChart.getAxisRight().setTypeface(MyApplication.giloryItaly);

The problem is the AxisLeft font value cannot be changed even when using

mChart.getAxisLeft().setTypeface(MyApplication.giloryItaly);

but works well for XAxis

Any solution how to change font type for AxisLeft and AxisRight?

like image 940
Amalo Avatar asked Oct 05 '17 08:10

Amalo


2 Answers

In you linechart, Use

LineChart horizontalPChartLine = (LineChart) findViewById(R.id.horizontalPChartLine);
        XAxis xAxis = horizontalPChartLine.getXAxis();
        xAxis.setTypeface(tf);
        xAxis.setTextSize(12f);
        xAxis.setTextColor(ColorTemplate.getHoloBlue());
        xAxis.setEnabled(true);

please check Styling / modifying the axis

like image 63
Amit Vaghela Avatar answered Nov 02 '22 06:11

Amit Vaghela


Paint p = mChart.getPaint(Chart.PAINT_INFO);
p.setTextSize(...);
p.setColor(...);
p.setTypeface(...);
like image 27
Akshay Chopde Avatar answered Nov 02 '22 04:11

Akshay Chopde