Reputation: 1643
I'm trying to plot some data using a visifire point chart, but instead of having rainbow colors I just want one single color, or maybe if I add another dataset, do a different color for each dataset I am plotting. Here is what I have so far.
ColorSet ct = new ColorSet();
ct.Id = "MyColorSet";
ct.Brushes.Add(new SolidColorBrush(Colors.Blue));
// Create a Chart element
Chart chart = new Chart();
//Create new instance of ColorSets class
chart.ColorSets = new ColorSets();
chart.ColorSets.Add(ct);
chart.ScrollingEnabled = false;
chart.AnimatedUpdate = true;
// Set chart width and height
chart.Width = 1400;
chart.Height = 400;
chart.ZoomingEnabled = true;
// Create new DataSeries
DataSeries dataSeries = new DataSeries();
dataSeries.RenderAs = RenderAs.Point;
dataSeries.MarkerType = MarkerTypes.Triangle;
dataSeries.MarkerSize = 3.5;
// Loop and add a few DataPoints
for (int loopIndex = 0; loopIndex < numOfPoints; loopIndex++)
{
// Create a DataPoint
DataPoint dataPoint = new DataPoint();
// Set the YValue using random number
dataPoint.YValue = arr[loopIndex].mass;
dataPoint.XValue = arr[loopIndex].num;
// Add DataPoint to DataSeries
dataSeries.DataPoints.Add(dataPoint);
}
// Add DataSeries to Chart
chart.Series.Add(dataSeries);
// Add chart to the LayoutRoot for display
ChartGrid.Children.Add(chart);
Upvotes: 0
Views: 750
Reputation: 1643
I figured it out.
System.Windows.Media.Brush brush = new SolidColorBrush(Colors.DarkRed);
dataSeries.Color = brush;
Upvotes: 1