我正在尝试使用 visifire 点图绘制一些数据,但我只想要一种颜色而不是彩虹色,或者如果我添加另一个数据集,则为我正在绘制的每个数据集使用不同的颜色。这是我到目前为止所拥有的。
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);