2012-04-06 13 views
0

基本的に私は複数の棒グラフを持つチャートを持っています。すべてのシリーズの独立した値は同じです。したがって、グラフのxaxは、同じ独立した値の積み重ねでレンダリングされます。Silverlight Toolkitチャート:xaxisラベルを表示しない

すべてのシリーズ(最初のものを除く)を表示しないようにするには、xaml宣言でどうすればよいですか?

誰でも私に助けてもらえますか?

更新:

私は、次のコードを例に遭遇しています

<toolkit:Chart x:Name="myChart" Width="600" Height="400"> 
<toolkit:LineSeries     
Title="Tasks" 
ItemsSource="{Binding}" 
IndependentValueBinding="{Binding Month}" 
DependentValueBinding="{Binding Task}">      
</toolkit:LineSeries> 

<toolkit:LineSeries     
Title="Benefits" 
ItemsSource="{Binding}" 
IndependentValueBinding="{Binding Month}" 
DependentValueBinding="{Binding Benefits}">    
</toolkit:LineSeries> 

<toolkit:Chart.Axes> 
<toolkit:LinearAxis Orientation="Y" Location="Left" Title="First" /> 
<toolkit:LinearAxis Orientation="Y" Location="Right" Title="Second" /> 
</toolkit:Chart.Axes>    
</toolkit:Chart> 

あなたは上記のコードをプロットした場合、あなたは両方のシリーズは左1からY値を基礎になることがわかります。どのようにして最初の系列が左の系列のY値に対してプロットされ、二番目の系列が右のYの値に対してプロットされるように、それを変更することができます。

は可能ですか?

ありがとうございました。

+0

グラフのXAMLをすべて共有することは可能でしょうか?私は単純なテストアプリケーションを書いたが、あなたの問題を再現することはできませんでした。 –

+0

サンプルが追加されました。ありがとう – developer

答えて

2

私はLineSeriesオブジェクトのDependentRangeAxisプロパティを使用して、あなたが望むものを達成できると思います。

まず、各Y軸にx:Name、たとえばTaskAxisBenefitsAxisを付けます。

その後、あなたはそれに該当するとして

DependentRangeAxis="{Binding ElementName=TaskAxis}" 

または

DependentRangeAxis="{Binding ElementName=BenefitsAxis}" 

プロパティを追加することによって、軸を使用するLineSeriesがを伝えることができます。

チャートの完全なXAML次いで

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

なる別のアプローチは、LineSeriesが内部Axisオブジェクトを移動させることです。これを行う方法のデモンストレーションはhereです。

+0

ありがとうございます。私の最初の問題を解決します。しかし、私はまだ私が望む最終版に変更することはできません。あなたは時間があればこの投稿を見てください。 http://stackoverflow.com/questions/10050691/silverlight-toolkit-chart-multiple-series-with-bar-and-line – developer

関連する問題