2011-02-02 6 views
0

나는이 wpf 툴킷으로 짜증이 나지 않았습니다. 설명서가 없습니다! 아.wpf 툴킷 분산 형 차트

어떻게 분산 형 차트의 선을 연결할 수 있습니까?

여러 계열에 걸쳐 선형 그래프를 생성해야합니다. 필자는 Excels 분산 형 차트를 사용하여 필요한 작업을 프로토 타입을 만들었지 만 필자의 경우 도구 키트에서 점을 연결하는 방법을 알 수 없습니다.

다음은 코드입니다. 옵션이 누락 되었습니까?

<my:Chart Name="myChart" Margin="5,5,5,5" Opacity="1" Width="525"> 
</my:Chart> 

ScatterSeries a = new ScatterSeries(); 
a.Title = "a"; 

a.IndependentValuePath = "Key"; 
a.DependentValuePath = "Value"; 
myChart.Series.Add(a); 

a = new ScatterSeries(); 
a.Title = "b"; 
a.IndependentValuePath = "Key"; 
a.DependentValuePath = "Value"; 
myChart.Series.Add(a); 

((ScatterSeries)myChart.Series[0]).ItemsSource = new KeyValuePair<DateTime, int>[] 
{ 
    new KeyValuePair<DateTime, int>(DateTime.Now.AddMonths(1), 0), 
    new KeyValuePair<DateTime, int>(DateTime.Now.AddMonths(2), 150), 
    new KeyValuePair<DateTime, int>(DateTime.Now.AddMonths(3), 150), 
    new KeyValuePair<DateTime, int>(DateTime.Now.AddMonths(4), 0), 
    new KeyValuePair<DateTime, int>(DateTime.Now.AddMonths(5), 0), 
    new KeyValuePair<DateTime, int>(DateTime.Now.AddMonths(8), 130), 
    new KeyValuePair<DateTime, int>(DateTime.Now.AddMonths(9), 130), 
    new KeyValuePair<DateTime, int>(DateTime.Now.AddMonths(10), 0), 
    new KeyValuePair<DateTime, int>(DateTime.Now.AddMonths(11), 0), 
    new KeyValuePair<DateTime, int>(DateTime.Now.AddMonths(15), 225), 
    new KeyValuePair<DateTime, int>(DateTime.Now.AddMonths(16), 225), 
    new KeyValuePair<DateTime, int>(DateTime.Now.AddMonths(17), 0) 
}; 


((ScatterSeries)myChart.Series[1]).ItemsSource = new KeyValuePair<DateTime, int>[] 
{ 
    new KeyValuePair<DateTime, int>(DateTime.Now.AddMonths(-21), 0), 
    new KeyValuePair<DateTime, int>(DateTime.Now.AddMonths(-5), 750), 
    new KeyValuePair<DateTime, int>(DateTime.Now.AddMonths(3), 750), 
    new KeyValuePair<DateTime, int>(DateTime.Now.AddMonths(7), 0), 
    new KeyValuePair<DateTime, int>(DateTime.Now.AddMonths(9), 0), 
    new KeyValuePair<DateTime, int>(DateTime.Now.AddMonths(10), 330), 
    new KeyValuePair<DateTime, int>(DateTime.Now.AddMonths(19), 330), 
    new KeyValuePair<DateTime, int>(DateTime.Now.AddMonths(20), 0), 
    new KeyValuePair<DateTime, int>(DateTime.Now.AddMonths(21), 0), 
    new KeyValuePair<DateTime, int>(DateTime.Now.AddMonths(25), 525), 
    new KeyValuePair<DateTime, int>(DateTime.Now.AddMonths(26), 525), 
    new KeyValuePair<DateTime, int>(DateTime.Now.AddMonths(27), 0) 
}; 

답변

3

분산 형 플롯은 점들과 라인을 연결하지 않습니다. LineSeries를 사용하는 대신 점을 연결해야합니다.

+0

그러면 문제가 해결됩니다! 정말 고맙습니다. – nitefrog