slandau
slandau

Reputation: 24052

.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 HtmlTextWriter(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?

Upvotes: 0

Views: 1615

Answers (1)

Scott Mitchell
Scott Mitchell

Reputation: 8759

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

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

Upvotes: 1

Related Questions