SVN r1104
SVN-Revision: r1104
This commit is contained in:
@@ -57,11 +57,22 @@ namespace Lskj.Control
|
||||
/// </summary>
|
||||
public bool transverseHistogram;
|
||||
|
||||
/// <summary>
|
||||
/// 分割条
|
||||
/// </summary>
|
||||
/// <value>The chart control object.</value>
|
||||
public DevExpress.XtraEditors.SplitContainerControl SplitMain { get { return this.splitMain; } }
|
||||
|
||||
|
||||
public ChartControlEx()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.splitMain.PanelVisibility = SplitPanelVisibility.Panel1;//初始化时默认隐藏下方
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// <para>说明:</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
@@ -91,6 +102,7 @@ namespace Lskj.Control
|
||||
{
|
||||
series.Label.TextPattern = "{V:0.00%}";
|
||||
}
|
||||
|
||||
switch (chart.ChartType)
|
||||
{
|
||||
default:
|
||||
@@ -265,6 +277,10 @@ namespace Lskj.Control
|
||||
chart.YValueField = item["YValueField"] + "";
|
||||
chart.IsAbsolutely = item.Table.Columns.Contains("IsAbsolutely") ? item["IsAbsolutely"] + "" : null;
|
||||
chart.YScale = item.Table.Columns.Contains("YScale") && !string.IsNullOrWhiteSpace(item["YScale"].ToString()) ? double.Parse(item["YScale"].ToString()) : 0;
|
||||
|
||||
chart.ChartColor= item.Table.Columns.Contains("ChartColor") ? item["ChartColor"] + "" : "";
|
||||
chart.ValueVisible = item.Table.Columns.Contains("valueVisible") ? "1".Equals(item["valueVisible"] + "") : false;
|
||||
chart.ChartTitle = item.Table.Columns.Contains("ChartTitle") ? item["ChartTitle"] + "" : "";
|
||||
this._models.Add(chart);
|
||||
}
|
||||
}
|
||||
@@ -290,25 +306,26 @@ namespace Lskj.Control
|
||||
|
||||
Series series = null;
|
||||
|
||||
|
||||
string Title = !string.IsNullOrWhiteSpace(chart.ChartTitle) ? chart.ChartTitle : chart.YAxisTitle;
|
||||
|
||||
switch (chart.ChartType)
|
||||
{
|
||||
case ChartType.LineChart:
|
||||
default:
|
||||
series = new Series(chart.YAxisTitle, chart.Chart3D == 1 ? ViewType.Line3D : ViewType.Line);
|
||||
series = new Series(Title, chart.Chart3D == 1 ? ViewType.Line3D : ViewType.Line);
|
||||
break;
|
||||
case ChartType.BarChart:
|
||||
series = new Series(chart.YAxisTitle, chart.Chart3D == 1 ? ViewType.Bar3D : ViewType.Bar);
|
||||
series = new Series(Title, chart.Chart3D == 1 ? ViewType.Bar3D : ViewType.Bar);
|
||||
//柱状图显示值出现在顶端
|
||||
BarSeriesLabel label = (BarSeriesLabel)series.Label;
|
||||
label.Position = BarSeriesLabelPosition.Top;
|
||||
|
||||
break;
|
||||
case ChartType.PieChart:
|
||||
{
|
||||
if (chart.Chart3D == 1)
|
||||
{
|
||||
series = new Series(chart.YAxisTitle, ViewType.Doughnut3D);
|
||||
series = new Series(Title, ViewType.Doughnut3D);
|
||||
PiePointOptions options = series.Label.PointOptions as PiePointOptions;
|
||||
((PiePointOptions)series.LegendPointOptions).PointView = PointView.ArgumentAndValues;
|
||||
Doughnut3DSeriesView view = series.View as Doughnut3DSeriesView;
|
||||
@@ -323,7 +340,7 @@ namespace Lskj.Control
|
||||
}
|
||||
else
|
||||
{
|
||||
series = new Series(chart.YAxisTitle, ViewType.Pie);
|
||||
series = new Series(Title, ViewType.Pie);
|
||||
PiePointOptions options = series.Label.PointOptions as PiePointOptions;
|
||||
series.LegendPointOptions.ValueNumericOptions.Format = NumericFormat.Percent;
|
||||
((PiePointOptions)series.LegendPointOptions).PointView = PointView.ArgumentAndValues;
|
||||
@@ -344,8 +361,12 @@ namespace Lskj.Control
|
||||
}
|
||||
if (series != null)
|
||||
{
|
||||
|
||||
this.CreateSeriesChart(chart, series, chartData, gridView);
|
||||
series.View.Color = System.Drawing.ColorTranslator.FromHtml(chart.ChartColor);
|
||||
|
||||
if(chart.ValueVisible) series.LabelsVisibility = DevExpress.Utils.DefaultBoolean.False;
|
||||
|
||||
this.cmMain.Series.Add(series);
|
||||
//if (chart.ChartType == ChartType.LineChart)
|
||||
//{
|
||||
@@ -382,8 +403,11 @@ namespace Lskj.Control
|
||||
this.cmMain.CustomDrawCrosshair += OnCmMainCustomDrawCrosshair;
|
||||
this.cmMain.CustomDrawSeriesPoint += OnCmMainCustomDrawSeriesPoint;
|
||||
// this.cmMain.Legend.AlignmentVertical = LegendAlignmentVertical.Top;
|
||||
this.cmMain.CrosshairOptions.ShowOnlyInFocusedPane = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// <para>说明:双击图表</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
@@ -520,6 +544,30 @@ namespace Lskj.Control
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 设置图标标题
|
||||
/// </summary>
|
||||
/// <param name="text"></param>
|
||||
/// <param name="color"></param>
|
||||
public void SetTitle(string text,string color)
|
||||
{
|
||||
|
||||
// 清空标题
|
||||
cmMain.Titles.Clear();
|
||||
// 创建标题
|
||||
ChartTitle chartTitle = new ChartTitle();
|
||||
chartTitle.Text = text; // 替换为你的实际标题内容
|
||||
chartTitle.Font = new Font("微软雅黑", 12, FontStyle.Bold); // 字体样式
|
||||
if(!string.IsNullOrWhiteSpace(color))chartTitle.TextColor = System.Drawing.ColorTranslator.FromHtml(color);
|
||||
chartTitle.Dock = ChartTitleDockStyle.Bottom; // 固定在顶部
|
||||
// 添加到图表
|
||||
cmMain.Titles.Add(chartTitle);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -544,4 +592,13 @@ namespace Lskj.Control
|
||||
/// <summary>
|
||||
/// 图表对象
|
||||
/// </summary>
|
||||
public class ChartMo
|
||||
public class ChartModel
|
||||
{
|
||||
/// <summary>
|
||||
/// The chart3 d
|
||||
/// </summary>
|
||||
public int Chart3D;
|
||||
/// <summary>
|
||||
/// The y axis shared
|
||||
/// </summary>
|
||||
public int YAxisShar
|
||||
Reference in New Issue
Block a user