2011-01-06 42 views
0
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); 

這是我當前的圖表。我如何將它變成線形圖而不是條形圖?另外,是否有辦法讓折線圖中的某一點粗體顯示,如同一個重要值的更明顯的點?.NET Charting 4.0 - 使線條代替酒吧

回答

1

您可以通過指定的圖表類型的系列對象的ChartType property

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

你知道我怎麼可以把一個標籤兩個Y和X軸? – slandau 2011-01-06 18:39:38