public static bool IsSideBySideStackedView(DevExpress.XtraCharts.ViewType view) { return(view == DevExpress.XtraCharts.ViewType.SideBySideStackedBar || view == DevExpress.XtraCharts.ViewType.SideBySideStackedBar3D || view == DevExpress.XtraCharts.ViewType.SideBySideFullStackedBar || view == DevExpress.XtraCharts.ViewType.SideBySideFullStackedBar3D); }
/// <summary> /// 根据数据创建一个图形展现 /// </summary> /// <param name="caption">图形标题</param> /// <param name="viewType">图形类型</param> /// <param name="dt">数据DataTable</param> /// <param name="rowIndex">图形数据的行序号</param> /// <returns></returns> private Series CreateSeries(string caption, DevExpress.XtraCharts.ViewType viewType, DataTable dt, int rowIndex) { Series series = new Series(caption, viewType); for (int i = 1; i < dt.Columns.Count; i++) { string argument = dt.Columns[i].ColumnName; //参数名称 decimal value = (decimal)dt.Rows[rowIndex][i]; //参数值 series.Points.Add(new SeriesPoint(argument, value)); } //必须设置ArgumentScaleType的类型,否则显示会转换为日期格式,导致不是希望的格式显示 //也就是说,显示字符串的参数,必须设置类型为ScaleType.Qualitative series.ArgumentScaleType = ScaleType.Qualitative; series.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True;//显示标注标签 return(series); }
private Series CreateSeries(DataTable dt, DevExpress.XtraCharts.ViewType viewType, NumericFormat format) { Series series = new Series("Serices1 ", viewType); series.DataSource = dt; series.ArgumentScaleType = ScaleType.Qualitative; series.ArgumentDataMember = "argument"; series.ValueScaleType = ScaleType.Numerical; series.ValueDataMembers.AddRange(new string[] { "datavalue" }); series.PointOptions.PointView = PointView.ArgumentAndValues; series.PointOptions.ValueNumericOptions.Format = format; if (format == NumericFormat.Number) { //series.PointOptions.ValueNumericOptions.Precision = 0; } series.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True;//显示标注标签 return(series); }
private void GetChartType(string p) { switch (p.ToLower()) { case "bar": _ViewType = DevExpress.XtraCharts.ViewType.Bar; break; case "line": _ViewType = DevExpress.XtraCharts.ViewType.Line; break; case "pie3d": _ViewType = DevExpress.XtraCharts.ViewType.Pie3D; break; case "pie": default: _ViewType = DevExpress.XtraCharts.ViewType.Pie; break; } }
public void ChangeChartType(DevExpress.XtraCharts.ViewType type) { try { this.ChangeView(type); if ((this.View as DevExpress.XtraCharts.SimpleDiagramSeriesViewBase) == null) { ChartParent.Legend.Visible = true; } if (ChartParent != null && ChartParent.Diagram is DevExpress.XtraCharts.Diagram3D) { DevExpress.XtraCharts.Diagram3D diagram = (DevExpress.XtraCharts.Diagram3D)ChartParent.Diagram; diagram.RuntimeRotation = true; diagram.RuntimeZooming = true; diagram.RuntimeScrolling = true; } foreach (DevExpress.XtraCharts.Series series in ChartParent.Series) { DevExpress.XtraCharts.ISupportTransparency supportTransparency = series.View as DevExpress.XtraCharts.ISupportTransparency; if (supportTransparency != null) { if ((series.View is DevExpress.XtraCharts.AreaSeriesView) || (series.View is DevExpress.XtraCharts.Area3DSeriesView) || (series.View is DevExpress.XtraCharts.RadarAreaSeriesView) || (series.View is DevExpress.XtraCharts.Bar3DSeriesView)) { supportTransparency.Transparency = 135; } else { supportTransparency.Transparency = 0; } } } } catch (Exception ex) { } }
public static bool IsPolarView(DevExpress.XtraCharts.ViewType view) { return(view == DevExpress.XtraCharts.ViewType.PolarArea || view == DevExpress.XtraCharts.ViewType.PolarLine || view == DevExpress.XtraCharts.ViewType.PolarPoint); }