2009-07-17 9 views
2

J'ai un problème pour lier correctement les données au graphique WPF. Quand je suis mise en ItemsSource je reçois l'erreur:Erreur de liaison de graphique WPF

Assigned dependent axis cannot be used. The data may not be able to be rendered on the provided axis or the series may require that they axis has an origin.

oc = new ObservableCollection<Pair>(); 
heartBeats.ItemsSource = oc; 

i Associez suis sauver int et long

XAML:

... 
xmlns:charting="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit" > 
<charting:Chart x:Name="ApplicatioChart"> 
      <charting:Chart.Series> 
       <charting:ColumnSeries x:Name="heartBeats" Title="Working Set" 
       DependentValueBinding="{Binding First}" IndependentValueBinding="{Binding Second}" > 

        <charting:ColumnSeries.IndependentAxis> 
         <charting:CategoryAxis Orientation="X" /> 
        </charting:ColumnSeries.IndependentAxis>      
        <charting:ColumnSeries.DependentRangeAxis> 
         <charting:LinearAxis Orientation="Y" /> 
        </charting:ColumnSeries.DependentRangeAxis> 

       </charting:ColumnSeries> 
      </charting:Chart.Series> 
     </charting:Chart> 

S'il vous plaît aider .. :(

+0

Vous semblez lier à la fois les valeurs dépendantes et indépendantes à « First » ?? – AnthonyWJones

Répondre

2

je résolus de cette façon:

<charting:Chart Title="Engine Performance" x:Name="ApplicationChart"> 
    <!-- Power curve --> 
    <charting:LineSeries x:Name="heartBeats" 
        Title="ManagedHeapSize"  
        IndependentValueBinding="{Binding EventTime}" 
        DependentValueBinding="{Binding ManagedHeapSize}"> 

     <!-- Vertical axis --> 
     <charting:LineSeries.DependentRangeAxis> 
      <charting:LinearAxis 
          Orientation="Y" 
          Title="ManagedHeapSize"         
          Interval="10000000" Focusable="True" 
          ShowGridLines="True"/> 
     </charting:LineSeries.DependentRangeAxis> 
    </charting:LineSeries>      

    <charting:Chart.Axes> 
     <!-- Shared horizontal axis --> 
     <charting:LinearAxis 
         Orientation="X" 
         Title="EventTime" 
         Interval="100" 
         ShowGridLines="True"/> 
    </charting:Chart.Axes> 
</charting:Chart> 
0

Impossible de voir quelque chose de mal avec le balisage (à l'exception de la même propriété étant liée à la fois comme la valeur dépendante et indépendante)

Il semble fonctionner correctement dans la version Silverlight, je n'ai pas la version WPF pour jouer avec. Essayez de supprimer la définition de DependentRangeAxis, pour voir si elle fonctionne avec celle par défaut.