| ||

SharpPlot Tutorials General Tutorials Chart Samples Style Examples SharpLeaf Tutorials Document Layout Tutorials Text Flow Tutorials Table Tutorials Visual Glossaries SharpPlot Class SharpPlot Methods SharpPlot Structures SharpPlot Enumerations PageMap Class SharpLeaf Reference SharpLeaf Class SharpLeaf Properties SharpLeaf Methods Table Class Table Properties Table Methods SharpLeaf Structures FontType Structure ParagraphStyle Structure BoxStyle Structure SharpLeaf Enumerations DocumentLayout Classes DocumentLayout Class PageLayout Class PageElement Abstract Class Frame : PageElement Class TextBlock : PageElement Class ImageBlock : PageElement Class Box : PageElement Class Rule : PageElement Class Common Reference Document Class VectorMath Class DbUtil Class Download Release Notes Licensing |
SharpPlot Reference > SharpPlot Properties > Flexibility Property ## SharpPlot.Flexibility PropertyWhen you use the ‘Trend’ style to draw an approximate curve through a scatter of points, it uses a default ‘flex’ value of 3 which actually sets the rate of die-away of the gaussian weighting used to emphasise nearby points. public double Flexibility {get; set;} A value of 0 will just draw an average (all points are weighted equally). A value of 100 will effectively force the line to visit every point. You will need to experiment with particular datasets to find the value that best hides the noise and reveals the underlying pattern in the data. ## Examplesp.Flexibility = 4; ## Technical dataFor the statistically-minded, who want to know how this actually works! It is a Gaussian-weighted moving average. The ‘Flexibility’ sets the exponent of the gaussian, so the way SharpPlot calculates it is to divide the x-axis range arbitrarily into 100 parts and for each point compute a y-value by adding up all the y-values from the data, weighted by the x-distance expressed as a classic ‘bell-curve’ function. I think the more traditional approach is to use an inverse exponential weighting based on the absolute distance, but this ‘peaks’ very sharply and also tends to ‘whiplash’ at the ends, whereas the gaussian is more flat-topped, so the trend is effectively an average of nearby points with far-away points included but heavily discounted. Basically, it just looks better for most reasonable timeseries! Note that for very small datasets (below about 10 points) the weighting is adjusted to prevent the curve simply forming plateaux at each data point. This adjustment is simply to maintain visual consistency, and has no mathematical significance whatsoever. ## See also ... |