xaml でチャート全体をバインドする方法を探しています。1 つのシリーズだけでなく、チャート全体。これは、チャートに複数のシリーズを動的に追加する必要があるためです。
XAML:
<chart:Chart DataContext="{Binding Path=FocusEnergyChart, UpdateSourceTrigger=PropertyChanged}"/>
C#:
public void DrawChart()
{
myChart = new Chart();
LinearAxis xAxis = new LinearAxis();
xAxis.Orientation = AxisOrientation.X;
xAxis.Title = "Energy";
LinearAxis yAxis = new LinearAxis();
yAxis.Orientation = AxisOrientation.Y;
yAxis.Title = "Focus";
myChart.Axes.Add(xAxis);
myChart.Axes.Add(yAxis);
myChart.Title = "Focus Energy - Chart";
foreach( string aKey in myGraphData.Keys)
{
BubbleSeries aSeries = new BubbleSeries();
aSeries.Title = aKey;
aSeries.ItemsSource = myGraphData[aKey];
aSeries.DependentValuePath = "Focus";
aSeries.IndependentValuePath = "Energy";
aSeries.SizeValuePath = "Size";
aSeries.SetResourceReference(Series.BackgroundProperty, "Background");
aSeries.SetResourceReference(BubbleSeries.LegendItemStyleProperty, "CustomLegendItemStyle");
aSeries.SetResourceReference(BubbleSeries.DataPointStyleProperty, "BubbleToolTipTemplate");
myChart.Series.Add(aSeries);
}
base.OnPropertyChanged("FocusEnergyChart");
}
public Chart FocusEnergyChart
{
get { return myChart; }
}
このコードを実行しようとすると、空の ChartArea が表示されます。
誰かが私を助けてくれることを願っています!
ありがとう!