In this article you will learn to change visual features from script. To learn more , Make sure to look at the example scene at “Extras/Example Scenes/Change properties from script”
Obtaining the visual feature object
In order to change a visual property , you must first obtain it from the category object. You can obtain it by it’s name with the GetVisualProperty method.
var cat = chart.DataSource.GetCategory("dataseries-1");
//obtain the point visual property
var point = cat.GetVisualFeature<GraphPointVisualFeature>("Graph Point-0");
//obtain the fill visual property
var fill = cat.GetVisualFeature<GraphFillVisualFeature>("Graph Fill-0");
//obtain a line visual property
var line = cat.GetVisualFeature<GraphLineVisualFeature>("Graph Line-0");
Changing the properties of a visual feature
The properties in the object correspond with the properties in the inspector. To learn more about them see the visual feature refrence
// point feature
point.PointSize = Random.value * 1f + 1f;
// fill feature
fill.CanvasSortOrder = Random.value > 0.5 ? -1 : 1;
fill.FillMaterital = Random.value > 0.5 ? Fill1 : Fill2;
// line feature
line.LineThickness = 5f;