The image below shows 5 plots over 2 hours (between 9am and 11am). 4 plots occur between 10 and 11. What I need is for the time scale to be evenly spaced 9--10--11 and the plots to conform to that, not evenly spaced by data point time. In the case below the density of plots would be higher between 10--11, if that makes sense?
Hello Peter,
I have been investigating into your requirement in this case, and for me to make a recommendation here, I believe I will need a little more information about the structure of your XamDataChart.
Namely, if you can please provide the type of X-Axis that you are using in this case. If you are using a CategoryXAxis, the behavior you are seeing is expected, but if you are using either the TimeXAxis or CategoryDateTimeXAxis, I believe this behavior can be worked around. Can you please provide the type of axis you are currently using?
Please let me know if you have any other questions or concerns on this matter.
Hi Andrew, thanks for having a look. I'm using numeric axis at the moment. In my data collection, I simplify the time to just the hour.
<igChart:XamDataChart x:Name="xmDataChart" DataContext="{Binding Path=PartogramCollection}" Margin="0,10,10,10"> <igChart:XamDataChart.Axes> <igChart:NumericYAxis x:Name="Station" IsInverted="True" MaximumValue="3" MinimumValue="-7" Strip="Transparent" MajorStroke="Transparent" TickLength="0"> <igChart:NumericYAxis.Label> <DataTemplate> <TextBlock Text="{Binding Item}" FontSize="14" FontWeight="Bold" Foreground="Blue" Visibility="{Binding Item, Converter={StaticResource myYConverter}}"> </TextBlock> </DataTemplate> </igChart:NumericYAxis.Label> </igChart:NumericYAxis> <igChart:NumericYAxis x:Name="Dilation" MaximumValue="10" MinimumValue="0" TickLength="0"> <igChart:NumericYAxis.LabelSettings > <igChart:AxisLabelSettings FontSize="14" FontWeight="Bold" Padding="20,0,5,0" Foreground="Black" /> </igChart:NumericYAxis.LabelSettings> </igChart:NumericYAxis> <igChart:CategoryXAxis x:Name="xmXAxis" ItemsSource="{Binding}" Label="{}{justHour}" Interval="1" MinorStroke="LightGray" MajorStroke="LightGray"> <igChart:CategoryXAxis.LabelSettings > <igChart:AxisLabelSettings Location="OutsideTop" /> </igChart:CategoryXAxis.LabelSettings> </igChart:CategoryXAxis> </igChart:XamDataChart.Axes> <igChart:XamDataChart.Series> <igChart:LineSeries ValueMemberPath="stationValue" Thickness="2" Brush="Blue" ItemsSource="{Binding}" UnknownValuePlotting="LinearInterpolate" XAxis="{Binding ElementName=xmXAxis}" YAxis="{Binding ElementName=Station}" ToolTip="{StaticResource StationToolTip}"> <igChart:LineSeries.MarkerTemplate> <DataTemplate> <Ellipse Height="20" Width="20" Fill="{Binding Item.laborStart, Converter={StaticResource MyFillConverter}}"/> </DataTemplate> </igChart:LineSeries.MarkerTemplate> </igChart:LineSeries> <igChart:LineSeries ValueMemberPath="dilationValue" Thickness="2" Brush="Red" MarkerBrush="Red" ItemsSource="{Binding}" UnknownValuePlotting="LinearInterpolate" XAxis="{Binding ElementName=xmXAxis}" YAxis="{Binding ElementName=Dilation}" ToolTip="{StaticResource DilationToolTip}"> <igChart:LineSeries.MarkerTemplate> <DataTemplate> <Polygon Points="0,4 6,10 0,16 4,20 10,14 16,20 20,16 14,10 20,4 16,0 10,6 4,0" Fill="Black"/> </DataTemplate> </igChart:LineSeries.MarkerTemplate> </igChart:LineSeries> </igChart:XamDataChart.Series> </igChart:XamDataChart >
Thank you for your update. It is as I had expected in my previous update to this thread – your x-axis is a CategoryXAxis. You will not be able to achieve your requirement with this axis type. The CategoryXAxis takes each data item as a “Category” and evenly spaces out those data items.
If your underlying x-axis criteria is a DateTime value as I can see that your Label for your CategoryXAxis is “justHour,” I would recommend usage of a CategoryDateTimeXAxis or TimeXAxis. Each of these axes have a “continuous” display that will allow you to achieve your requirement. You can read about the TimeXAxis at the following documentation article.
Another option if your x-axis criteria is numeric is to use a NumericXAxis. This will very likely require you to use a different series type, as LineSeries does not work with NumericXAxis – ScatterLineSeries, however, does.
Thanks. This makes sense. I've converted to a CategoryDateTimeXAxis. For some reason TimeXAxis was not available. The article linked talks about TimeXAxis and it seems to have some nice feature features like setting time interval. I'll read some more and try to determine why I can't make my axis a TimeXAxis.
I am glad you were able to convert to a CategoryDateTimeXAxis. Regarding why the TimeXAxis is not available for you, this could be due to the version you are using. The TimeXAxis is rather new, and was added in version 2017.2 of the Infragistics for WPF controls. If you are using an earlier version to 17.2, this axis type will not exist.
Thanks, I figured it was a version thing. The client version is 15.2, so I'm stuck with that. I have explored NumericXAxis and Scatter series. I think that will do what I need.
Thanks again
Peter