【问题标题】:Visifire point chart with only one color只有一种颜色的 Visifire 点图
【发布时间】:2013-04-23 02:20:21
【问题描述】:

我正在尝试使用 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);     

【问题讨论】:

    标签: c# charts visifire


    【解决方案1】:

    我想通了。

     System.Windows.Media.Brush brush = new SolidColorBrush(Colors.DarkRed);
     dataSeries.Color = brush;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-11-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-07-13
      • 2014-12-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多