xaml LineSeries error

Aug 10, 2009 at 5:03 PM

Hello, i am trying to use a line series chart in my application and i am recieving and error...

"No suitable axis is available for plotting the dependent value"

any ideas would help...   thanks!!

  <font size="2" color="#0000ff"><font size="2" color="#0000ff">

<

</font></font><font size="2" color="#0000ff">

 

</font>

chartingToolkit:Chart x:Name="graph" Title="Testing" Margin="366.4,0,220.6,63.8" BorderThickness="0" LegendStyle="{DynamicResource LegendStyle}" VerticalAlignment="Bottom" Height="238">

<chartingToolkit:LineSeries ItemsSource="{Binding}"Title="Values" DependentValueBinding="{Binding Key}" IndependentValueBinding="{Binding Value}" >  <font size="2" color="#a31515"><font size="2" color="#a31515">

 

</font></font><font size="2" color="#a31515">

 

</font>

     <chartingToolkit:LineSeries.DataPointStyle> 

         <Style TargetType="chartingToolkit:DataPoint"> <font size="2" color="#a31515"><font size="2" color="#a31515">

 

</font></font><font size="2" color="#a31515">

 

</font>

            <Setter Property="Background" Value="#FFDE9090"/> <font size="2" color="#a31515"><font size="2" color="#a31515">

 

</font></font><font size="2" color="#a31515">

 

</font>

            <Setter Property="Visibility" Value="Hidden"/> <font size="2" color="#a31515"><font size="2" color="#a31515">

 

</font></font><font size="2" color="#a31515">

 

</font>

         </Style> <font size="2" color="#a31515"><font size="2" color="#a31515">

 

</font></font><font size="2" color="#a31515">

 

</font>

     </chartingToolkit:LineSeries.DataPointStyle> <font size="2" color="#a31515"><font size="2" color="#a31515">

 

</font></font><font size="2" color="#a31515">

 

</font>

</chartingToolkit:LineSeries> <font size="2" color="#a31515"><font size="2" color="#a31515">

 

</font></font><font size="2" color="#a31515">

 

</font>

<chartingToolkit:Chart.Axes> <font size="2" color="#a31515"><font size="2" color="#a31515">

 

</font></font><font size="2" color="#a31515">

 

</font>

   <chartingToolkit:DateTimeAxis Orientation="X" Location="Bottom"> <font size="2" color="#a31515"><font size="2" color="#a31515">

 

</font></font><font size="2" color="#a31515">

 

</font>

      <chartingToolkit:DateTimeAxis.AxisLabelStyle> <font size="2" color="#a31515"><font size="2" color="#a31515">

 

</font></font><font size="2" color="#a31515">

 

</font>

        <Style TargetType="chartingToolkit:AxisLabel"> <font size="2" color="#a31515"><font size="2" color="#a31515">

 

</font></font><font size="2" color="#a31515">

 

</font>

           <Setter Property="StringFormat" Value="{}{0:hh:mm:ss}" /> <font size="2" color="#a31515"><font size="2" color="#a31515">

 

</font></font><font size="2" color="#a31515">

 

</font>

        </Style> <font size="2" color="#a31515"><font size="2" color="#a31515">

 

</font></font><font size="2" color="#a31515">

 

</font>

       </chartingToolkit:DateTimeAxis.AxisLabelStyle> <font size="2" color="#a31515"><font size="2" color="#a31515">

 

</font></font><font size="2" color="#a31515">

 

</font>

    </chartingToolkit:DateTimeAxis> <font size="2" color="#a31515"><font size="2" color="#a31515">

 

</font></font><font size="2" color="#a31515">

 

</font>

    <chartingToolkit:LinearAxis Orientation="Y" Location="Left" Title="Value" ShowGridLines="True" /> <font size="2" color="#a31515"><font size="2" color="#a31515">

 

</font></font><font size="2" color="#a31515">

 

</font>

</chartingToolkit:Chart.Axes> <font size="2" color="#a31515"><font size="2" color="#a31515">

 

</font></font><font size="2" color="#a31515">

 

</font>

</chartingToolkit:Chart>

public List<DataValue> points = new List<DataValue>();

points.Add(new DataValue(DateTime.Now, val) );

 

graph.Series[0].DataContext = points;

graph.Refresh();

 

 

<font size="2" color="#0000ff"><font size="2" color="#0000ff">

public

</font></font><font size="2" color="#0000ff">

 

</font>

class DataValue

{

    public DateTime time { get; set; } <font size="2">

 

</font>

   public double value { get; set; }

    public DataValue(DateTime t,double v)

    {          time = t;          value = v;

    }

}

 

<font size="2" color="#0000ff"><font size="2" color="#0000ff">

 

</font></font><font size="2" color="#0000ff">

 

</font>

 

Aug 10, 2009 at 5:10 PM

maybe this is better....

 

<chartingToolkit:Chart x:Name="graph" Title="Testing" Margin="366.4,0,220.6,63.8" BorderThickness="0" LegendStyle="{DynamicResource LegendStyle}" VerticalAlignment="Bottom" Height="238">

<chartingToolkit:LineSeries
            ItemsSource="{Binding}"
            Title="Values"
            DependentValueBinding="{Binding Key}"
            IndependentValueBinding="{Binding Value}" >

   <chartingToolkit:LineSeries.DataPointStyle>
      <Style TargetType="chartingToolkit:DataPoint">
         <Setter Property="Background" Value="#FFDE9090"/>
         <Setter Property="Visibility" Value="Hidden"/>
      </Style>
   </chartingToolkit:LineSeries.DataPointStyle>

</chartingToolkit:LineSeries>

<chartingToolkit:Chart.Axes>
    <chartingToolkit:DateTimeAxis Orientation="X" Location="Bottom">
      <chartingToolkit:DateTimeAxis.AxisLabelStyle>
        <Style TargetType="chartingToolkit:AxisLabel">
          <Setter Property="StringFormat" Value="{}{0:hh:mm:ss}" />
        </Style>
      </chartingToolkit:DateTimeAxis.AxisLabelStyle>
    </chartingToolkit:DateTimeAxis>

    <chartingToolkit:LinearAxis
              Orientation="Y"
              Location="Left"
              Title="Value"
              ShowGridLines="True" />

    </chartingToolkit:Chart.Axes>
</chartingToolkit:Chart>


public List<DataValue> points = new List<DataValue>();

points.Add(new DataValue(DateTime.Now, val) );
graph.Series[0].DataContext = points;
graph.Refresh();

 

public class DataValue
{

   public DateTime time { get; set; }
   public double value { get; set; }

   public DataValue(DateTime t,double v)
   {
          time = t;
          value = v;
   }

}

 

 

 


 

Coordinator
Aug 17, 2009 at 9:25 PM

For one thing, the DependentValueBinding/IndependentValueBinding are probably wrong because the actual property names on the DataValue class are "time" and "value", not "Key" and "Value". Does that help?