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
210
CategoryXAxis labeling
posted

I am having trouble getting labels to show up for my X-Axis.  I have a column series in which I  want the labels on the X-Axis to be the index of the item in the list.

xaml code

<ig:NumericYAxis x:Name="YAxis" MinimumValue="0" Interval="0.4" Label="{}{}" FontSize="9" MaximumValue="1.6" MajorStroke="DodgerBlue">
<ig:NumericYAxis.LabelSettings>
<ig:AxisLabelSettings Extent="35" />
</ig:NumericYAxis.LabelSettings>
</ig:NumericYAxis>
<ig:CategoryXAxis x:Name="XAxis" ItemsSource="{Binding}" Label="{}{Category}">
<ig:CategoryXAxis.LabelSettings>
<ig:AxisLabelSettings Extent="20" VerticalAlignment="Bottom" FontSize="11"/>
</ig:CategoryXAxis.LabelSettings>
</ig:CategoryXAxis>

<ig:XamDataChart.Series>
<ig:ColumnSeries x:Name="Series1" ItemsSource="{Binding}" ValueMemberPath="BusVoltageMagnitude" Title="BusVoltageMagnitude" XAxis="{Binding ElementName=XAxis}" YAxis="{Binding ElementName=YAxis}" Brush="DodgerBlue" Outline="Black">
</ig:ColumnSeries>
</ig:XamDataChart.Series>

C# code behind

public static class GeoLocations
{
public static ObservableCollection<Bus> locations = new ObservableCollection<Bus>();
}

public class Bus
{

    public int BusVoltageMagnitude{get; set; }

}

I'm still very new to this so I'm hoping I'm just missing something easy here.

Parents
  • 30945
    Offline posted

    Hello Matthew,

     

    Thank you for your email. I have been looking into your question and if I understand correctly, you wish to display the index of the items in the labels. If this is correct, I can suggest setting the Label property of the CategoryXAxis to a DataTempalte that contains a TextBlock. After doing so, you can set the Text property of the TextBlock to a MultiBinding and bind it to the item corresponding to the label and also to the ItemsSource of the axis and in the converter you can return the index of the item. I have created  sample application for you, that shows how you can implement this approach.

     

    Please let me know if you need any further assistance on the matter.

     

    Sincerely,

    Krasimir

    Developer Support Engineer

    Infragistics

    www.infragistics.com/support

    IndexOnXAxisLabels.zip
Reply Children
No Data