开发者

.NET Charting 4.0 -- make line instead of bar

var pointCollection = lastValuation.ValuationExposureCollection[lastValuation.ValuationExposureCollection.Count - 1].ExposurePointCollection;

                System.Web.UI.DataVisualization.Charting.Chart Chart2 = new System.Web.UI.DataVisualization.Charting.Chart();
                Chart2.Width = 350;
                Chart2.Height = 350;
                Chart2.RenderType = RenderType.ImageTag;

                Chart2.Palette = ChartColorPalette.BrightPastel;
                Chart2.ChartAreas.Add("Series 1");
                Chart2.ChartAreas["Series 1"].BackColor = System.Drawing.Color.Transparent;

                // create a couple of series  
                Chart2.Series.Add("Series");

                // databinding
                Chart2.DataSource = pointCollection;
                Chart2.Series[0].XValueMember = "ExposureDate";
                Chart2.Series[0].XValueType = ChartValueType.Date;
                Chart2.Series[0].YValueMembers = "MaximumExposure";


                Chart2.BackColor = System.Drawing.Color.FromArgb(211, 223, 240); //"#D3DFF0"
                Chart2.BorderSkin.SkinStyle = BorderSkinStyle.Emboss;
                Chart2.BackGradientStyle = GradientStyle.TopBottom;

                // Render chart control  
                Chart2.Page = this;

                Page.Response.Clear();

                HtmlTextWriter writer = new HtmlTe开发者_JAVA百科xtWriter(Page.Response.Output);
                Chart2.RenderControl(writer);

This is my current chart. How do I turn this into a line graph instead of a bar chart? Also, is there a way to make one of the points in the line chart bolded out as like a more noticeable point for an important value?


You can specify the chart type via the Series object's ChartType property:

Chart2.Series[0].ChartType = SeriesChartType.Line;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜