1

I am using MPAndroidChart, this is the chart I need to create:

This is my pic

Hi everyone. Please help me. I'm trying to customize this chart but I can't make it come be better. have some problems:

  1. How to add new axis at bottom chart?
  2. How to hide horizontal lines?
Philipp Jahoda
  • 50,880
  • 24
  • 180
  • 187
Long Giang
  • 651
  • 1
  • 5
  • 7

2 Answers2

1
List<String> xAxisValues; // YOUR DATA HERE
...
IAxisValueFormatter xAxisFormatter = new IAxisValueFormatter() {
    @Override
    public String getFormattedValue(float value, AxisBase axis) {
        return xAxisValues.get((int) value);
    }
};
...
XAxis xAxis = chart.getXAxis();
xAxis.setTextColor(Color.BLUE));
xAxis.setValueFormatter(xAxisFormatter);

I beleive the above line will match your need, below stuff will be useful may be,

LineDataSet set1 = new LineDataSet(values, title);
set1.setColor(Color.RED); // Your line color
set1.addColor(Color.GRAY); // Your Blue
set1.setCircleColor(Color.BLUE);
set1.setLineWidth(3f); // Increase here for line width
set1.setCircleRadius(10f);
set1.setDrawCircleHole(true);
set1.setValueTextSize(9f);
set1.setDrawFilled(true);
set1.setFormLineWidth(10f);

set1.setFormLineDashEffect(new DashPathEffect(new float[]{10f, 5f}, 0f));
set1.setFormSize(15.f);

Fine tune according to your need in above code see comments The below two lines are important for the smooth line and filled color

set1.setMode(LineDataSet.Mode.CUBIC_BEZIER);
set1.setFillColor(Color.BLUE); // Change your color
Nandha
  • 128
  • 10
0

For the horizontal issue, please refere to this page

Here, I think it will be :

YourObjettoDrawVariable.getAxisRight().setDrawLabels(false);

But, it is always better to show your code for ccontext purpose. I hope it's help.

Community
  • 1
  • 1
  • Thank for your answer. But my problems is how to show a row as u see that (T1 T2 T3 ...). Sorry i'm bad english! Hope you help me! – Long Giang Jan 20 '17 at 02:43
  • Did you mind to show a moke of your expected result? Do not worry about your English, my is no better! – A. Le Bars Jan 20 '17 at 10:45