2010-03-03 3 views
2

안녕하세요, 저는 X 축과 Y 축의 레이블을 설정하는 방법을 알고 싶습니다.wpf 툴킷 차트의 y 축과 x 축을 어떻게 설정할 수 있습니까? y : kg, x : years와 같은 것

이제는 값이있는 차트가 있는데 도구 설명 서식을 지정하지만 X 축의 Y 축 레이블을 설정하는 방법을 알 수 없습니다.

또 하나의 문제는 차트 시리즈에서 확대/축소를 실행할 수 있다는 것입니다. 몇 년 만에 x 축을 사용하면 월로 변경하거나 학기와 새로운 지점을 줄에 표시해야합니다. ? 이것이 가능하다면 너무 어렵다.

답변

1

y 축 레이블을 설정할 수 없지만 (가능하지는 않다고 생각합니다.) Title 속성을 사용하여 범례에 설정할 수 있습니다. x 축에서 그것은 DataPointSeries'IndependentValueBinding의 바인딩 세트에 따라 다릅니다.

이 샘플에서는 모든 레코드/데이터 포인트를 나타내는 클래스 개체를 만들었습니다.

List<ChartInfo> list = new List<ChartInfo>(); 
ChartInfo item = new ChartInfo(); 
item.Label = "Individual"; 
item.Vale = 27; 
list.Add(item); 
item = new ChartInfo(); 
item.Label = "Corporate"; 
item.Vale = 108; 
list.Add(item); 

DataPointSeries series = new ColumnSeries(); 
series.Title = "Quantity"; 
series.DependentValueBinding = new Binding("Value"); 
series.IndependentValueBinding = new Binding("Label"); 
series.ItemsSource = list; 
series.SelectionChanged += new SelectionChangedEventHandler(series_SelectionChanged); 
this.chartingToolkitControl.Series.Add(series); 

그것은 나에게이 결과를 줄 것이다 :

public class ChartInfo 
{ 
    public string Label { get; set; } 
    public double Value { get; set; } 
} 

그런 다음이 코드가 있습니다. 줌에 대한

alt text http://www.freeimagehosting.net/uploads/78e2598620.jpg

- 내가 올바른 용어는 드릴 다운 생각합니다. SelectionChanged 이벤트를 사용할 수 있습니다 (위의 코드 참조). 당신이해야 할 일은 당신의 데이터 소스를 다시 쿼리하고 그래프의 시리즈를 지우고 당신의 질의 결과에 기초하여 새로운 것을 추가하는 것입니다.

private void series_SelectionChanged(object sender, SelectionChangedEventArgs e) 
    { 
     //The sender here is of type DataPointSeries wherein you could get the SelectedItem (in our case ChartInfo) and from there you could do the requery. 
    } 
+0

답변 해 주셔서 감사합니다. 정말 도움이됩니다. 그런 식으로 줌을 생각하지 않았습니다. 감사. – Clerks

+0

@ Clerks - 대답이 도움이된다면 투표를 잊어 버리고 질문의 대답으로 표시해야합니다. :) –

관련 문제