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
300
XamDataChart xAxis
posted

Hi,

I am use an example where the XamDataChart is a control that can be used in win forms. In the example the x Axis does not show. I am not sure how the styling functions work. How do I display the x Axis and format it to DateTime and set the interval to daily.

Thanks

Pieter

 

 

 

Parents
  • 300
    Suggested Answer
    posted

    Hi,

    Ok I got this to work, in the samples on the web they show that we must use a CategoryXAxis and just format the label as date time, in my DataContext the X Axis is already a DateTime field then this solution does not work. I change it to CategoryDateTimeXAxis and format the label the way I want it. It works now but now I have a new problem when you Zoom in is cutting of the trace, not sure way but I think its something to do with the intervals of the X Axis, It’s not making the intervals smaller when I zoom.  I don’t know how to set the intervals on the CategoryDateTimeXAxis.

    I am not getting any response on my other posts hope someone will respond on this one.

    Thanks,

    Pieter

  • 30692
    Suggested Answer
    Offline posted in reply to Pieter
  • 300
    posted in reply to Graham Murray

    Hi Graham,

    Thanks for the reply, I almost thought you guys bailed.

     See the image below where I try to zoom, and then the second image is my results of the zoom.

    If I use the mouse wheel and roll it back a couple of times I get the third image. I cannot send you the source code but I can give some snippets. I am using the CategoryDateTimeXAxis and I am getting the X values out of a SQL database and it’s a datetime field. The X intervals are changing (or subdividing), but something is going wrong on the display of the chart. You can see Figure 2 and 3.

    I am adding the Xaml code, it’s a bit messy,  it’s a couple of samples mixed.

     

     

    <UserControl x:Class="XamDataChartControl.XamDataChartHostControl"

                 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

                 xmlns:igChart="clr-namespace:Infragistics.Windows.DataChart;assembly=Infragistics.Windows.DataVisualization.DataChart.v10.1"

                 xmlns:igCtrl="clr-namespace:Infragistics.Windows.Controls;assembly=Infragistics.Windows.DataVisualization.Controls.v10.1"

                 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

                 xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

                 mc:Ignorable="d">

        <UserControl.Resources>

            <LinearGradientBrush x:Key="rscGradientBackground" StartPoint="0.0, 0.0" EndPoint="1.0, 1.0">

                <GradientStop Color="#FFFFFFFF" Offset="0" />

                <GradientStop Color="#c0c2c8" Offset="0.4" />

                <GradientStop Color="#e0e2e8" Offset="1" />

            </LinearGradientBrush>

            <Style x:Key="rscXamDataChartStyle" TargetType="igChart:XamDataChart">

                <Setter Property="PlotAreaBackground" Value="Transparent" />

            </Style>

            <Style x:Key="LegendStyle" TargetType="{x:Type igChart:Legend}">

                <Setter Property="Background">

                    <Setter.Value>

                        <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">

                            <GradientStop Color="White" Offset="0" />

                            <GradientStop Color="White" Offset="0.5" />

                            <GradientStop Color="White" Offset="0.5" />

                            <GradientStop Color="#FFE8E8EF" Offset="1" />

                        </LinearGradientBrush>

                    </Setter.Value>

                </Setter>

                <Setter Property="BorderBrush" Value="{DynamicResource rscGradientBorder}"/>

                <Setter Property="BorderThickness" Value="0.75" />

                <Setter Property="Orientation" Value="Vertical" />

                <Setter Property="Padding" Value="4" />

                <Setter Property="Margin" Value="2" />

                <Setter Property="Template">

                    <Setter.Value>

                        <ControlTemplate TargetType="{x:Type igChart:Legend}">

                            <Grid Margin="{TemplateBinding Margin}">

                                <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="3" Background="Transparent" CornerRadius="4">

                                    <Grid Margin="{TemplateBinding Padding}">

                                        <Grid.RowDefinitions>

                                            <RowDefinition Height="Auto" />

                                            <RowDefinition Height="Auto" />

                                            <RowDefinition Height="*" />

                                        </Grid.RowDefinitions>

                                        <ContentPresenter Content="{TemplateBinding Content}" Margin="0" Grid.Row="1" />

                                        <ScrollViewer BorderThickness="0" HorizontalScrollBarVisibility="Auto" Grid.Row="2" VerticalScrollBarVisibility="Auto" Margin="3,0,0,0">

                                            <ContentPresenter x:Name="ContentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" Grid.Row="1" />

                                        </ScrollViewer>

                                    </Grid>

                                </Border>

                                <Border BorderBrush="Transparent" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="4" IsHitTestVisible="False">

                                    <Border.Background>

                                        <LinearGradientBrush EndPoint="0,1" Opacity="0" StartPoint="0,0">

                                            <GradientStop Color="Transparent" Offset="0" />

                                            <GradientStop Color="#10FFFFFF" Offset="0.499" />

                                            <GradientStop Color="Transparent" Offset="0.501" />

                                        </LinearGradientBrush>

                                    </Border.Background>

                                </Border>

                            </Grid>

                        </ControlTemplate>

                    </Setter.Value>

                </Setter>

            </Style>

            <LinearGradientBrush x:Key="rscGradientBorder" StartPoint="0.0, 0.0" EndPoint="0.0, 1.0">

                <GradientStop Color="#FFFFFFFF" Offset="0" />

                <GradientStop Color="#c0c2c8" Offset="0.75" />

                <GradientStop Color="#e0e2e8" Offset="1" />

            </LinearGradientBrush>

        </UserControl.Resources>

        <igChart:XamDataChart x:Name="xmDataChart" Grid.Row="1" Style="{StaticResource rscXamDataChartStyle}"

                              Legend="{Binding ElementName=Legend}" GridMode="BehindSeries" PlotAreaBackground="White" PlotAreaBorderThickness="1" DataContext="{Binding}" OverridesDefaultStyle="False">

            <igChart:Legend igCtrl:XamDock.Edge="OutsideRight" x:Name="Legend"

                            Style="{DynamicResource LegendStyle}"

                            igCtrl:XamDock.VerticalAlignment="Center" />

            <igChart:XamDataChart.Axes>

                <igChart:CategoryDateTimeXAxis x:Name="XAxis" ItemsSource="{Binding}" DateTimeMemberPath="Column0" Label="{}{}" MajorStroke="Black" >

                    <igChart:CategoryDateTimeXAxis.LabelSettings>  

                        <igChart:AxisLabelSettings Location="OutsideBottom" Extent="30"/>

                    </igChart:CategoryDateTimeXAxis.LabelSettings>

                </igChart:CategoryDateTimeXAxis>

                <igChart:NumericYAxis x:Name="YAxis" Label=" {} " MajorStroke="Black">

                    <igChart:NumericYAxis.LabelSettings >

                        <igChart:AxisLabelSettings Location="OutsideLeft" Extent="55"/>

                    </igChart:NumericYAxis.LabelSettings>

                </igChart:NumericYAxis>

                <igChart:NumericYAxis x:Name="Y2Axis" Label=" {} " MajorStroke="Black" >

                    <igChart:NumericYAxis.LabelSettings >

                        <igChart:AxisLabelSettings Location="OutsideRight" Extent="60"/>

                    </igChart:NumericYAxis.LabelSettings>               

                </igChart:NumericYAxis>

                <igChart:NumericYAxis x:Name="Y3Axis" Label=" {} " MaximumValue="3" MinimumValue="1" MajorStroke="Black">

                    <igChart:NumericYAxis.LabelSettings >

                        <igChart:AxisLabelSettings Location="OutsideLeft" Extent="50" />

                    </igChart:NumericYAxis.LabelSettings>

                </igChart:NumericYAxis>

            </igChart:XamDataChart.Axes>       

            <igChart:XamDataChart.Series>

     

Reply Children