How can I draw seamless curve using android graphics ?

I want to draw seamless curve using Android graphics using like followings

 canvas.quadTo(.....);

Android reference said that this method using Bezier curve

but this method don't support drawing curve which have more than three points

P1 , P2 , P3 , P4 , P5

How can I draw curve like followings?

I heard this is "Nonlinear Curve Fitting".

Is there available curve fitting library for android ?

Answers


While for iPhone you have the DataAnalysis, for Android you can use Google Analytics SDK v2 for what you have in mind.

Here is an example of a query:

var lineChart = getChartObj();
lineChart.setParams(barChart.getParams());
lineChart.setParam('cht', 'lc');
lineChart.setParam('chm', '');
var lineChartURL = paramsToURL(chartData.chartParams, chartData.baseURL);
drawChart('visitorDiv',lineChartURL);

You may find interesting to check more details on charts to specifically match the model you want to plot.

Another alternative you can also consider is QML using Line Graph with Qt Quick:

Graph.LineGraph {
    width: parent.width
    height: parent.height - legend.height - parent.spacing
    model: learningProgressModel

    dimensions: [
        Graph.Dimension {
            id: accuracyDimension
            dataColumn: 5
            color: "#ffb12d"
            maximumValue: 1.0
            label: i18n("Accuracy")
            unit: "%"
            unitFactor: 100
        },
        Graph.Dimension {
            id: charactersPerMinuteDimension
            dataColumn: 6
            color: "#38aef4"
            maximumValue: 400
            label: i18n("Characters per Minute")
        }
    ]
}

Octave for Android may also be interesting, specially if you want to have a wide option of plotting models. You can use the command drawBezierCurve, providing only the points from your data:

points = [0 0; 3 1; -2 1; 1 0];
 drawBezierCurve(points);
 hold on
 plot(points([1 4],1),points([1 4],2),'go');
 plot(points([2 3],1),points([2 3],2),'rs');
 line(points([1 2],1),points([1 2],2),'color','k');
 line(points([3 4],1),points([3 4],2),'color','k');
 h = drawBezierCurve(points, 'discretization', 6, 'color','r');
 hold off        

Then to achieve the Nonlinear Curve Fitting that you want to display on your Android, just use the data or model that better fits your need.


Need Your Help

CSS column-count and Chrome bug: how to avoid overflow content being cropped

html css column-count

When column-count is used, it seems to crop any overflow content.