Cubic line chart
Hi,
This is the first time that I use the MPAndroidchart librairy, the 3.0.1 version ia used.
I have a little problem with my line chart, the curve is not well drawn
This is my config :
lineDataSetEvent.setMode(LineDataSet.Mode.CUBIC_BEZIER); lineDataSetEvent.setColor(Constants.colors.get(k)); lineDataSetEvent.setDrawValues(false); lineDataSetEvent.setDrawCircles(false);

What is I do bad in my config ? Did I forget something ?
@Malcom100 Could you include the entire setup code you used to generate the chart above and also the chart you expect to generate with the library?
dataSets = new ArrayList<ILineDataSet>();
for(Map.Entry<String,List<ValuesAxis>> v : channelsMap.entrySet())
String key = v.getKey();
List<ValuesAxis> values = v.getValue();
List<Entry> entries = new ArrayList<Entry>();
for(ValuesAxis value : values){
float x = value.getTime().floatValue();
float y = (float) value.getValue();
entries.add(new Entry(x,y));
String nameLabel;
if(labelsName != null && labelsName.containsKey(key)){
nameLabel = labelsName.get(key);
}
LineDataSet lineDataSet = new LineDataSet(entries,nameLabel);
lineDataSet.setColor(Constants.colors.get(i));
lineDataSet.setDrawValues(false);
lineDataSet.setDrawCircles(false);
lineDataSet.setMode(LineDataSet.Mode.CUBIC_BEZIER);
lineDataSet.setCubicIntensity(0.2f);
dataSets.add(lineDataSet);
}
lineChart.setData(dataSet);
lineChart.getAxisRight().setEnabled(false);
lineChart.getDescription().setEnabled(false);
lineChart.setDrawMarkerViews(true);
CustomMarkerView customMarkerView = new CustomMarkerView(context,R.layout.layout_marker_view,canMoveX ? "r" : scale);
lineChart.setMarkerView(customMarkerView);
Legend legend = lineChart.getLegend();
legend.setPosition(Legend.LegendPosition.BELOW_CHART_LEFT);
legend.setXEntrySpace(7f);
legend.setYEntrySpace(0f);
legend.setYOffset(0);
legend.setWordWrapEnabled(true);
XAxis xAxis = lineChart.getXAxis();
xAxis.setValueFormatter(new MyXAxisValueFormatter(canMoveX ? "r" : scale));
xAxis.setPosition(XAxis.XAxisPosition.TOP);
xAxis.setTextSize(8);
xAxis.setLabelCount(8);
xAxis.setDrawGridLines(false);
lineChart.setScaleMinima(1,1);
lineChart.invalidate();
I woul like have a cubic line chart like this :

I have the same issue with the cubic line chart even if if I set it to Max lineDataSet.setCubicIntensity(1.0f), cubic line just could not have the smooth curvature !
I guess you do not have any solutions
Instead of CUBIC_BEZIER, try using HORIZONTAL_BEZIER and see if that works any better. I had all sorts of problems with CUBIC_BEZIER.
Why your times series x-axis valueformatter look so erratic at 5 minutes gap against the input voltage plot , is your input continuously feeding data into into chart to be graphed ? I suggest you have a look at the real-time chart example to see how to feed new data non-stop into the chart
I replace CUBIC_BEZIER by HORIZENTAL_BEZIER and this is better thanks @JStav.
@TSG9876 where can I find this example, in the Github project ?
I tested my continuous data feed with 1second interval using the default setting such as lineDataSet.setMode(LineDataSet.Mode.CUBIC_BEZIER); lineDataSet.setCubicIntensity(0.2f); and curve look quite ok now , at max =1.0f becomes too winding end up as polar curve instead.
sample cubic line chart and many other examples could be found at
https://github.com/PhilJay/MPAndroidChart/blob/master/MPChartExample/src/com/xxmassdeveloper/mpchartexample/CubicLineChartActivity.java
Hi all, I have the same issue now, I posted it on stack overflow, but no one is seeming to respond. Can anyone please help me?
https://stackoverflow.com/questions/45104391/mpandroidchart-making-curved-graphs
Thank you.
I am an avid developer new to android. I want to draw a cubic Bézier curve. i am designing a profile screen i thought it would be nice behind the user's profile photo. what can i do about it.
