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
15
WPF XAMDatachart Custom Tick Mark Values for XAxis/YAxis Columns with different color for different columns
posted

Hi Team,
I need help with the below scenario, I can create one sample if you want me to.

I have one ObservableCollection in my view model like below
[

{ Layername = "LSS", Value = 7542, Depth = 200, Porosity = 0.3, Sw = 0.5, Temperature = 150}

Layername = "LSS base", Value = 7742, Depth = 144, Porosity = 0.25, Sw = 0.15, Temperature = 160}

{ Layername = "Dean", Value = 7886, Depth = 115, Porosity = 0.5, Sw = 0.25, Temperature = 150 }

{ Layername = "WA", Value = 8001, Depth = 64, Porosity = 0.45, Sw = 0.15, Temperature = 160 }

{ Layername = "WA Midlle", Value = 8065, Depth = 65, Porosity = 0.3, Sw = 0.45, Temperature = 150 }

{ Layername = "WA Lower", Value = 8130, Depth = 105, Porosity = 0.2, Sw = 0.5, Temperature = 160 }

];

I used XamDataChart to plot the Porosity, Sw and Temperature as shown in the Image and I have used the code below

<Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="50"/>
        <RowDefinition Height="*"/>
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="280"/>
        <ColumnDefinition Width="280"/>
        <ColumnDefinition Width="280"/>
        <ColumnDefinition Width="280"/>
        <!--<ColumnDefinition MinWidth="280"/>
            <ColumnDefinition MinWidth="280"/>
            <ColumnDefinition MinWidth="280"/>
            <ColumnDefinition MinWidth="280"/>-->
    </Grid.ColumnDefinitions>
    <Label Content="Porosity" Grid.Row="0" Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Bottom" FontWeight="Bold"/>
    <ig:XamDataChart x:Name="porosityDataChart" Grid.Row="1">
        <ig:XamDataChart.LayoutTransform>
            <RotateTransform Angle="90"/>
        </ig:XamDataChart.LayoutTransform>
        <ig:XamDataChart.Axes>
            <ig:CategoryXAxis x:Name="poroXAxis" ItemsSource="{Binding CurrentProject.UTMFLayers}"
                              Label="{}{Name} ({PositiveTopDepthDisplayValue})" Title="Layers (Depth)"
                              MajorStroke="LightGray" MajorStrokeThickness="1" TickLength="0">
                <ig:CategoryXAxis.TitleSettings>
                    <ig:TitleSettings FontWeight="Bold" FontSize="12"></ig:TitleSettings>
                </ig:CategoryXAxis.TitleSettings>
                <ig:CategoryXAxis.LabelSettings>
                    <ig:AxisLabelSettings Location="OutsideBottom" Foreground="Gray"/>
                </ig:CategoryXAxis.LabelSettings>

            </ig:CategoryXAxis>
            <ig:NumericYAxis x:Name="poroYAxis" MinimumValue="0" MaximumValue="1" Interval="0.2"/>
        </ig:XamDataChart.Axes>
        <ig:XamDataChart.Series>
            <ig:StepLineSeries ItemsSource="{Binding CurrentProject.UTMFLayers}" ValueMemberPath="PorosityValue" Title="Porosity"
                               XAxis="{Binding ElementName=poroXAxis}" YAxis="{Binding ElementName=poroYAxis}" Thickness="1" MarkerType="None"/>
        </ig:XamDataChart.Series>
    </ig:XamDataChart>
    
    <Label Content="Water Saturation" Grid.Row="0" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Bottom" FontWeight="Bold"/>
    <ig:XamDataChart x:Name="swDataChart" Grid.Row="1" Grid.Column="1" Margin="0,2">
        <ig:XamDataChart.LayoutTransform>
            <RotateTransform Angle="90"/>
        </ig:XamDataChart.LayoutTransform>
        <ig:XamDataChart.Axes>
            <ig:CategoryXAxis x:Name="swXAxis" ItemsSource="{Binding CurrentProject.UTMFLayers}" MajorStroke="LightGray" MajorStrokeThickness="1" TickLength="0">
                <ig:CategoryXAxis.LabelSettings>
                    <ig:AxisLabelSettings Visibility="Collapsed"/>
                </ig:CategoryXAxis.LabelSettings>
            </ig:CategoryXAxis>
            <ig:NumericYAxis x:Name="swYAxis" MinimumValue="0" MaximumValue="1" Interval="0.2"/>
        </ig:XamDataChart.Axes>
        <ig:XamDataChart.Series>
            <ig:StepLineSeries ItemsSource="{Binding CurrentProject.UTMFLayers}" ValueMemberPath="WaterSaturationValue" Title="Porosity"
                               XAxis="{Binding ElementName=swXAxis}" YAxis="{Binding ElementName=swYAxis}" Thickness="1" MarkerType="None"/>
        </ig:XamDataChart.Series>
    </ig:XamDataChart>

    <Label Content="Temperature" Grid.Row="0" Grid.Column="2" HorizontalAlignment="Center" VerticalAlignment="Bottom" FontWeight="Bold"/>
    <ig:XamDataChart x:Name="temperatureDataChart" Grid.Row="1" Grid.Column="2">
        <ig:XamDataChart.LayoutTransform>
            <RotateTransform Angle="90"/>
        </ig:XamDataChart.LayoutTransform>
        <ig:XamDataChart.Axes>
            <ig:CategoryXAxis x:Name="temperatureXAxis" ItemsSource="{Binding CurrentProject.UTMFLayers}" 
                      MajorStroke="LightGray" MajorStrokeThickness="1" TickLength="0">
                <ig:CategoryXAxis.LabelSettings>
                    <ig:AxisLabelSettings Visibility="Collapsed"/>
                </ig:CategoryXAxis.LabelSettings>

            </ig:CategoryXAxis>
            <ig:NumericYAxis x:Name="temperatureYAxis" MinimumValue="100" MaximumValue="300" />
        </ig:XamDataChart.Axes>
        <ig:XamDataChart.Series>
            <ig:StepLineSeries ItemsSource="{Binding CurrentProject.UTMFLayerTempData}" Title="Temperature"
                       XAxis="{Binding ElementName=temperatureXAxis}" YAxis="{Binding ElementName=temperatureYAxis}" Thickness="1" MarkerType="Diamond"/>
        </ig:XamDataChart.Series>
    </ig:XamDataChart>
</Grid>


Now I want to Align the TickMarks(Layers) according to their Depth Values, and Each Layer with Different Color as shown in Img_2
Can this be achievable..?
I followed the xamdatachart forum and tried to use CustomTickMarvalues.cs and ChartBehaviors.cs. But somehow the binding data is not working from My ViewModel and have difficulty in setting background color for each layer.
Any help would be greatly appreciated, I can create one sample app if you need..

Thanks,
Venkat

Parents Reply Children