2012-07-18 2 views
0

DataVisualization 용 WPF Toolkit 2010 버전을 사용하고 있습니다.개체 필드에 LineSeries 값 바인딩

LineSeries 차트를 프로그래밍 방식으로 만들려는 경우 이전에 수행 한 작업입니다. 이 코드는 올바르게 작동하고 데이터를 표시합니다.

public class TrendData { 
    public string Group; 
    public IEnumerable<KeyValuePair<DateTime, decimal>> Series; 
} 
... 
//somewhere within my chart update method 
foreach (TrendData line in DataCollection) { 
    LineSeries l = new LineSeries() { 
     DependentValuePath = "Value", 
     IndependentValuePath = "Key", 
     Title = line.Group, 
     ItemsSource = line.Series 
    }; 
    Chart.Series.Add(l); 
} 

이 정보는 문제없이 작동합니다. 그러나 DataPoint의 마우스 오버에 대한 추가 정보를 표시하고 싶기 때문에 데이터 포인트에 다른 값을 저장하려고합니다. ,

public class TrendData { 
    public string Group; 
    public IEnumerable<PointData> Series; 
} 
public class PointData { 
    public DateTime time; 
    public decimal rate; 
    public int x; 
} 
... 
//somewhere within my chart update method 
foreach (TrendData line in DataCollection) { 
    LineSeries l = new LineSeries() { 
     DependentValuePath = "rate", 
     IndependentValuePath = "time", 
     Title = line.Group, 
     ItemsSource = line.Series 
    }; 
    Chart.Series.Add(l); 
} 

이 작동하지 않는 대신 DataPointSeries에서 나에게 InvalidOperationException: "No suitable axis is available for plotting the dependent value."을 제공 : 그래서 나는 순진하게도이 시도.

아이디어가 있으십니까? 이 일을 완전히 잘못하고 있습니까?

답변

1

이것은 완전히 완벽하게 작동합니다. 방금 다른 곳에서 내 코드에 오타가 있었기 때문에이 문제가 발생했습니다.

+0

DependentValueBinding의 오타 때문에이 오류가 발생했습니다. –