Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
55
DataBinding observable collection to Xamchart
posted

I evaluting  Infragistic  xamchart .I have following  questions. 

1. Is there  any efficient way to plot a graph instead  of plotting data points one by one ? I want  to directly bind  my collection  to xamchart having y data .If yes how is implementation?/

2.Is it supporting  to annotation, cross hair ??? 

 

  • 739
    posted

    Binding xamChart control to an ObservableCollection using the Object data provider:

    1. Create a Microsoft® Windows® Presentation Foundation Window project.

    2. Create a Resource section in your Window and add an Object data provider to it.

    In XAML:

    ...
    <Window.Resources>
     <ObjectDataProvider x:Key="PatientData" ObjectType="{x:Type local:PatientBusinessLogic}" MethodName="GetPatients" />
    </Window.Resources>
    ...

    At this point, you have everything in place to retrieve data. Now we can create a xamChart control and bind it to data using the Object data provider above.

    In XAML:

    ...
    <igCA:XamChart x:Name="Chart1">
     <igCA:XamChart.Series>
      <igCA:Series Label="Patient Height" ChartType="Column" DataSource="{Binding Source={StaticResource PatientData}}" DataMapping="Label = Name; Value = Height" />
      <igCA:Series Label="Patient Weight" ChartType="Column" DataSource="{Binding Source={StaticResource PatientData}}" DataMapping="Value = Weight" />
      <igCA:Series Label="Patient Systolic A.P." ChartType="Column" DataSource="{Binding Source={StaticResource PatientData}}" DataMapping="Value = SystolicPressure" />
      <igCA:Series Label="Patient Dyastolic A.P." ChartType="Column" DataSource="{Binding Source={StaticResource PatientData}}" DataMapping="Value = DiastolicPressure" />
     </igCA:XamChart.Series>
    </igCA:XamChart>
    ...

     

    Run the project to see a visual representation of the data in the collection.


    You can also check the Data Binding Objects sample in the sample browser for complete example.

    Please, could you give me more info about cross hair? Would you like to use it for data points?

    Please

    Regards,
    GoranS