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
215
Plotting not working with NumericXAxis
posted

Is there any way to show custom tickmarks on CategoryXAxis in xamdatachart.

I tried this with NumericXAxis and it works but i am but able to plot the graph due to some databinding issues (i guess).

 

below is my code that i trid . Any quick help is highly appreciated .

<ig:XamDataChart Name="VariablesDataChart" HorizontalZoomable="True" VerticalZoomable="True" Background="{DynamicResource NgSDefaultBackground}" Height="300">                       

<ig:XamDataChart.Axes>

<ig:NumericXAxis x:Name="xAxis" MinimumValue="0" MaximumValue="120" Interval="30" DataContext="{Binding ElementName=VariablesDataChart, Path=Series[(System:Int32)0].ItemsSource}" />

<ig:NumericYAxis x:Name="yAxis"/>           

</ig:XamDataChart.Axes>

<local:SeriesBinder.BindingInfo>

<local:SeriesBindingInfo ItemsSource="{Binding Path=TrendItemsForPlotting}">

<local:SeriesBindingInfo.SeriesTemplate>

<DataTemplate>

<ig:LineSeries   

ItemsSource="{Binding Item.TrendItem.Data}"

Title="{Binding Item.VariableName}"

ValueMemberPath="{Binding Item.TrendItem.ValueMemberPath}" 

XAxis="{Binding Path=Owner.Axes[(System:Int32)0]}" 

YAxis="{Binding Path=Owner.Axes[(System:Int32)1]}"

MarkerType="None"

<ig:LineSeries.Brush>                                              

<SolidColorBrush Color="{Binding Item.SeriesColor}" />                                         

 

</ig:LineSeries.Brush>                                             

<ig:LineSeries.Legend>

                                                   

<Binding RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType={x:Type View:TrendWindowView}}"

                                               

Path="SeriesLegend"/>

                                               

</ig:LineSeries.Legend>

                                               

<ig:LineSeries.ToolTip>

                                                   

<StackPanel Orientation="Vertical">

                                                       

<TextBlock Text="{Binding Series.Title}"

                                                     

FontWeight="Bold" />

                                                       

<StackPanel Orientation="Horizontal">

                                                           

<TextBlock Text="Value : "/>

                                                           

<TextBlock Text="{Binding Item.Value}"/>

                                                       

</StackPanel>

                                                       

<StackPanel Orientation="Horizontal">

                                                           

<TextBlock Text="Time : " />

                                                           

<TextBlock Text="{Binding Item.Timestamp}" />

                                                       

</StackPanel>

                                                   

</StackPanel>

                                               

</ig:LineSeries.ToolTip>

                                               

<ig:LineSeries.LegendItemTemplate>

                                                   

<DataTemplate>

                                                       

<StackPanel Orientation="Horizontal" Width="auto" Margin="0">

                                                           

<ig:XamColorPicker Width="25" VerticalAlignment="Center" Margin="0,0,5,0" DataContext="{Binding Series.DataContext}"

                                                                     

SelectedColor="{Binding Path=Item.SeriesColor, Mode=TwoWay}"/>

                                                           

<ContentPresenter Content="{Binding Series.Title, TargetNullValue=Series Title}"

                                                              

Margin="0,0,5,0" VerticalAlignment="Center" />

                                                       

</StackPanel>

                                                   

</DataTemplate>

                                               

</ig:LineSeries.LegendItemTemplate>

                                           

</ig:LineSeries>

                                       

</DataTemplate>

                                   

</local:SeriesBindingInfo.SeriesTemplate>

                               

</local:SeriesBindingInfo>

                           

</local:SeriesBinder.BindingInfo>

                       

</ig:XamDataChart>

  • 30692
    Suggested Answer
    Offline posted

    Line series is a category series and is designed to work with category axes only. If you want to use a numeric x axis you must use scatterLineSeries. You can use numbers on a CategoryXAxis though, if you desire. They are just treated as string labels.

  • 138253
    Offline posted

    Hello,

     

    I am just checking the progress of this issue and was wondering if you managed to achieve your goal or if you need any further assistance on the matter.  

  • 138253
    Offline posted

    Hello,

     

    Thank you for your post. I have been looking into, but since I cannot be completely sure how your data is organized, I am not able to conclude what can cause your issue, so could you please send an isolated sample project, where the issue is reproduced, so I can investigate it further for you.

     

    Looking forward for your reply.