2012-04-07 78 views
0

我有問題以我想要的方式顯示網格。但我也不確定在Silverlight工具包圖表中是否可以這樣做。所以任何幫助或方向,將不勝感激。Silverlight工具包圖表:帶條形和線形的多個系列

<Grid x:Name="LayoutRoot" Background="White"> 
<charting:Chart x:Name="myChart" Width="600" Height="400"> 
<charting:BarSeries     
Title="Tasks" 
ItemsSource="{Binding Path=Data1}" 
IndependentValueBinding="{Binding Month}" 
DependentValueBinding="{Binding Task}" 
DependentRangeAxis="{Binding ElementName=TaskAxis}"> 
</charting:BarSeries> 
<charting:LineSeries     
Title="Benefits" 
ItemsSource="{Binding Path=Data1}" 
IndependentValueBinding="{Binding Month}" 
DependentValueBinding="{Binding Benefits}" 
DependentRangeAxis="{Binding ElementName=BenefitsAxis}"> 
</charting:LineSeries> 
<charting:Chart.Axes> 
<charting:LinearAxis Orientation="Y" Location="Left" Title="First" x:Name="TaskAxis" /> 
<charting:LinearAxis Orientation="Y" Location="Right" Title="Second" x:Name="BenefitsAxis" /> 
</charting:Chart.Axes> 
</charting:Chart> 
</Grid> 

鑑於上述片段中,是有可能有在Y軸左邊顯示當月和上x軸顯示的任務值,X軸底部顯示的收益值。

所以從某種意義上說,它是分享Yaxis的月份。它可以使用頂部/底部x軸或者甚至是右側Y軸來繪製任務和收益值。

你們認爲什麼?

謝謝。

回答

1

下面的例子對頂部的任務軸和好處軸線上的底部,與左邊的共享Y-軸:

<toolkit:Chart x:Name="myChart" Width="600" Height="800"> 
    <toolkit:BarSeries     
      Title="Tasks" 
      ItemsSource="{Binding Path=Data1}" 
      IndependentValueBinding="{Binding Month}" 
      DependentValueBinding="{Binding Task}" 
      DependentRangeAxis="{Binding ElementName=TaskAxis}"> 
    </toolkit:BarSeries> 

    <toolkit:BarSeries     
      Title="Benefits" 
      ItemsSource="{Binding Path=Data1}" 
      IndependentValueBinding="{Binding Month}" 
      DependentValueBinding="{Binding Benefits}" 
      DependentRangeAxis="{Binding ElementName=BenefitsAxis}"> 
    </toolkit:BarSeries> 

    <toolkit:Chart.Axes> 
     <toolkit:LinearAxis Orientation="X" Location="Top" Title="Task" x:Name="TaskAxis" /> 
     <toolkit:LinearAxis Orientation="X" Location="Bottom" Title="Benefits" x:Name="BenefitsAxis" /> 
    </toolkit:Chart.Axes> 
</toolkit:Chart> 
相關問題