非常感谢您提供的代码,它确实能够解决"select data"上确定后的图形问题,但是在选择"select data"时还是会看到图形是柱形的,而非锥形,只有点确定它才会变,不过就像您说的,暂时应急是可以了的,下面是我的代码在工作表中新增一个圆锥,您看看,是不是我的代码的哪个地方没注意,也许它能够帮到您怎么重现,谢谢!!!
- private void btnBarSeriesFullCone30_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
- {
- //ReportMethods.AddBarChart2(fpSpread1, typeof(FarPoint.Win.Chart.BarSeries), FarPoint.Win.Chart.ChartViewType.View3D, false, FarPoint.Win.Chart.BarShape.FullCone, true, fpChart1);
- if (fpSpread1.ActiveSheet == null)
- return;
- Type seriesType = typeof(FarPoint.Win.Chart.BarSeries);
- ChartViewType viewType = FarPoint.Win.Chart.ChartViewType.View3D;
- BarShape barShape = FarPoint.Win.Chart.BarShape.FullCone;
- bool isVertical = true;
- fpSpread1.ActiveSheet.AddChart(0, 0, seriesType, 200, 200, 200, 200, viewType, true);
- FarPoint.Win.Chart.YPlotArea plotArea = fpSpread1.ActiveSheet.Charts[fpSpread1.ActiveSheet.Charts.Count - 1].Model.PlotAreas[0] as FarPoint.Win.Chart.YPlotArea;
- plotArea.Vertical = isVertical;
- if (barShape != BarShape.Box)
- {
- for (int i = 0; i < plotArea.Series.Count; i++)
- {
- if (plotArea.Series[i] is FarPoint.Win.Chart.ClusteredBarSeries)
- {
- for (int j = 0; j < (plotArea.Series[i] as FarPoint.Win.Chart.ClusteredBarSeries).Series.Count; j++)
- {
- (plotArea.Series[i] as FarPoint.Win.Chart.ClusteredBarSeries).Series[j].BarShape = barShape;
- }
- }
- else if (plotArea.Series[i] is FarPoint.Win.Chart.StackedBarSeries)
- {
- for (int j = 0; j < (plotArea.Series[i] as FarPoint.Win.Chart.StackedBarSeries).Series.Count; j++)
- {
- (plotArea.Series[i] as FarPoint.Win.Chart.StackedBarSeries).Series[j].BarShape = barShape;
- }
- }
- else if (plotArea.Series[i] is FarPoint.Win.Chart.BarSeries)
- {
- (plotArea.Series[i] as FarPoint.Win.Chart.BarSeries).BarShape = barShape;
- }
- }
- }
- fpSpread1.ActiveSheet.Charts[fpSpread1.ActiveSheet.Charts.Count - 1].PropertyChanged += new PropertyChangedEventHandler(frmReportMain_PropertyChanged);
- }
- void frmReportMain_PropertyChanged(object sender, PropertyChangedEventArgs e)
- {
- if (e.PropertyName.Equals("Model"))
- {
- foreach (FarPoint.Win.Chart.BarSeries item in fpSpread1.ActiveSheet.Charts[fpSpread1.ActiveSheet.Charts.Count - 1].Model.PlotAreas[0].Series)
- {
- item.BarShape = FarPoint.Win.Chart.BarShape.FullCone;
- }
- }
- }
复制代码 |