gpt4 book ai didi

c#devexpress饼图系列点颜色变化

转载 作者:行者123 更新时间:2023-11-30 21:10:36 25 4
gpt4 key购买 nike

我使用 devexpress 制作了动态 3d 饼图。控制功能的出色表现给我留下了深刻的印象。不过,我有点沮丧。我希望我的饼图点具有我在代码中设置的不同颜色(这将由用户使用某种形式的托盘或组合框更改,尚不确定)。不幸的是,我似乎无法为我的数据系列的点获取颜色方法。

这是排除大量注释掉尝试的代码:

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;

所以我需要像 chartcontrol2.series1.point[0].color = color.blue; 这样的东西像这样。

最佳答案

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

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

How to: Custom Paint Series Points

ChartControl.CustomDrawSeries Event

关于c#devexpress饼图系列点颜色变化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8385739/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com