2011-01-06 3 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 차트 작성 4.0 - 막대 대신 줄을 만듭니다

답변

1

당신은을 통해 차트 유형을 지정할 수 있습니다 시리즈 객체의 ChartType property :

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

당신은 내가 Y 및 X 축 모두에 레이블을 넣을 수있는 방법을 알고 계십니까? – slandau

+0

@slandau : 점을 그릴 때 레이블 값을 지정합니다. 네가 그 일을하는 곳을 못 본다. Microsoft 차트 컨트롤을 사용하여 내 기사를 체크 아웃하는 것이 좋습니다? http://www.4guysfromrolla.com/articles/072209-1.aspx –

+0

아주 좋습니다. 그러나 그것들은 데이터를 플로팅 할 때마다 레이블처럼 보입니다. 단지 두 개의 레이블 만 있으면됩니다. 각 축이 무엇인지 말해주는 하나. – slandau