Machado
Machado

Reputation: 10354

How to draw smooth line chart with MPAndroid avoiding cubic bezier going on wrong values?

I'll give an example, this is my chart (please notice that I already reduced bezier intensity to reduce the wrongness of the line):

image

I would like it to be rendered this way:

image

Please forgive the terrible drawn red line, I just used MS Paint to make it quick, hehe.

I wanted my chart to look like the red line in second example, where the edge of my curve is my value and not 0.1fx before my value point. I also noticed that when using the xAxis enabled, it dind't properly show my values, which where integers from 0 to 4 (inclusive), but was shown as floats like 0.9, 1.9, ..., 3.9, matching the bezier curve edges. I believe this is wrong.

For the record the bezier mode is being applied to my data set with dataSet.mode = LineDataSet.Mode.CUBIC_BEZIER.

Upvotes: 3

Views: 1242

Answers (1)

aax
aax

Reputation: 454

LineDataSet.Mode.HORIZONTAL_BEZIER instead of CUBIC_BEZIER should do the job.

Upvotes: 6

Related Questions