c#devexpress piechart系列点的颜色变化 [英] c# devexpress piechart series point color change

查看:2258
本文介绍了c#devexpress piechart系列点的颜色变化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用devexpress制作了一个动态的三维饼图。我真的印象深刻的控制功能是多么好。我打了一点点下来,虽然。
我想我的饼图点有不同的颜色,我在代码中设置(这将稍后由用户使用某种形式的托盘或组合框,不确定)。不幸的是,我似乎无法为我的数据系列的点获得一个颜色方法。



这里的代码不包括注释尝试的质量:

 系列series1 =新系列(Series1,ViewType.Pie3D); 

chartControl2.Series.Add(series1);

series1.DataSource = chartTable;
series1.ArgumentScaleType = ScaleType.Qualitative;
series1.ArgumentDataMember =names;
series1.ValueScaleType = ScaleType.Numerical;
series1.ValueDataMembers.AddRange(new string [] {Value});

//series1.Label.PointOptions.PointView = PointView.ArgumentAndValues;
series1.LegendPointOptions.PointView = PointView.ArgumentAndValues;
series1.LegendPointOptions.ValueNumericOptions.Format = NumericFormat.Percent;
series1.LegendPointOptions.ValueNumericOptions.Precision = 0;

//调整系列的值数值选项。
series1.Label.PointOptions.ValueNumericOptions.Format = NumericFormat.Percent;
series1.Label.PointOptions.ValueNumericOptions.Precision = 0;

//调整系列的视图类型特定选项。
((Pie3DSeriesView)series1.View).Depth = 20;
((Pie3DSeriesView)series1.View).ExplodedPoints.Add(series1.Points [0]);
((Pie3DSeriesView)series1.View).ExplodedPoints.Add(series1.Points [1]);
((Pie3DSeriesView)series1.View).ExplodedPoints.Add(series1.Points [2]);
((Pie3DSeriesView)series1.View).ExplodedPoints.Add(series1.Points [3]);
((Pie3DSeriesView)series1.View).ExplodedDistancePercentage = 20;

chartControl2.Legend.Visible = true;

所以我需要像chartcontrol2.series1.point [0] .color = color.blue;

解决方案

在绘制图表的系列点时绘制图表。为此,您应该处理ChartControl.CustomDrawSeriesPoint事件,然后您可以使用其事件args更改一些绘图参数。



检查这些事件以实现您的功能。 。



如何:自定义绘画系列点

ChartControl.CustomDrawSeries事件


I've made a dynamic 3d piechart using devexpress. I'm really impressed with how good the control feature is. I've hit a little bit of a downer though. I would like my pie chart points to have different colors that I set in code (this will later be changed by the user using some form of pallet or combo box, not sure yet). Unfortunatly I can't seem to get a color method for the points of my data series.

Here's the code excluding the mass of commented out attempts:

Series series1 = new Series("Series1", ViewType.Pie3D);

        chartControl2.Series.Add(series1);

        series1.DataSource = chartTable;
        series1.ArgumentScaleType = ScaleType.Qualitative;
        series1.ArgumentDataMember = "names";
        series1.ValueScaleType = ScaleType.Numerical;
        series1.ValueDataMembers.AddRange(new string[] { "Value" });

        //series1.Label.PointOptions.PointView = PointView.ArgumentAndValues;
        series1.LegendPointOptions.PointView = PointView.ArgumentAndValues;
        series1.LegendPointOptions.ValueNumericOptions.Format = NumericFormat.Percent;
        series1.LegendPointOptions.ValueNumericOptions.Precision = 0;

        // Adjust the value numeric options of the series.
        series1.Label.PointOptions.ValueNumericOptions.Format = NumericFormat.Percent;
        series1.Label.PointOptions.ValueNumericOptions.Precision = 0;

        // Adjust the view-type-specific options of the series.
        ((Pie3DSeriesView)series1.View).Depth = 20;
        ((Pie3DSeriesView)series1.View).ExplodedPoints.Add(series1.Points[0]);
        ((Pie3DSeriesView)series1.View).ExplodedPoints.Add(series1.Points[1]);
        ((Pie3DSeriesView)series1.View).ExplodedPoints.Add(series1.Points[2]);
        ((Pie3DSeriesView)series1.View).ExplodedPoints.Add(series1.Points[3]);
        ((Pie3DSeriesView)series1.View).ExplodedDistancePercentage = 20;

        chartControl2.Legend.Visible = true;

So I need something like chartcontrol2.series1.point[0].color = color.blue; something like this.

解决方案

Drawing in charts when drawing the series points of charts. To do this you should handle the ChartControl.CustomDrawSeriesPoint event, and then you can change some of the drawing parameters using its event args.

check these events to do your functinality..

How to: Custom Paint Series Points

ChartControl.CustomDrawSeries Event

这篇关于c#devexpress piechart系列点的颜色变化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆