-1

I made two Charts. In both of them is one single linechart. They have different values on the x- and y-axis. But I want to show them both at the same time. So I have to make the background and axis of the second chart transparent. Only the line should stay visible, so that I can see it in the first chart. It doesen´t matter that the axis aren´t then correct anymore for the second chart .

Chart 1: enter image description here

Chart 2: enter image description here

This is how it should look like when both charts are visible: enter image description here

And this is the XAML I already coded. How can I change the background and axis to transparent or hidden?:

<chartingToolkit:Chart Background="White" BorderThickness="0">
            <chartingToolkit:LineSeries  DependentValuePath="Value" IndependentValuePath="Key" ItemsSource="{Binding DemandPrice}" IsSelectionEnabled="True" Visibility="{Binding TodayVisible}">
                <chartingToolkit:LineSeries.Style>
                    <Style TargetType="chartingToolkit:LineSeries" BasedOn="{StaticResource {x:Type chartingToolkit:LineSeries}}">
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="chartingToolkit:LineSeries">
                                    <Canvas x:Name="PlotArea">
                                        <Polyline x:Name="polyline"
                                                          Points="{TemplateBinding Points}"                                           
                                                          Style="{TemplateBinding PolylineStyle}"
                                                          StrokeThickness="4" >
                                            <Polyline.Stroke>
                                                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                                    <GradientStop Color="Gray" Offset="0"/>
                                                    <GradientStop Color="Gray" Offset="1"/>
                                                </LinearGradientBrush>
                                            </Polyline.Stroke>
                                        </Polyline>
                                    </Canvas>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>
                </chartingToolkit:LineSeries.Style>
                <chartingToolkit:LineSeries.DataPointStyle>
                    <Style TargetType="chartingToolkit:LineDataPoint">
                        <Setter Property="Background" Value="Transparent" />
                    </Style>
                </chartingToolkit:LineSeries.DataPointStyle>
            </chartingToolkit:LineSeries>
        </chartingToolkit:Chart>

        <chartingToolkit:Chart Background="Transparent" BorderThickness="0">
            <!-- EEX Price-->
            <chartingToolkit:LineSeries DependentValuePath="Value" IndependentValuePath="Key" ItemsSource="{Binding EEXPrice}" IsSelectionEnabled="True" Background="{StaticResource AccentColorBrush}" Visibility="{Binding EEXVisible}">
                <chartingToolkit:LineSeries.Style>
                    <Style TargetType="chartingToolkit:LineSeries" BasedOn="{StaticResource {x:Type chartingToolkit:LineSeries}}">
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="chartingToolkit:LineSeries">
                                    <Canvas x:Name="PlotArea">
                                        <Border
                                                                Background="Transparent"
                                                                BorderBrush="Transparent"
                                                                BorderThickness="0">
                                        </Border>
                                        <Polyline x:Name="polyline"
                                                          Points="{TemplateBinding Points}"                                           
                                                          Style="{TemplateBinding PolylineStyle}"
                                                          StrokeThickness="4">
                                            <Polyline.Stroke>
                                                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                                    <GradientStop Color="Blue" Offset="0"/>
                                                    <GradientStop Color="Blue" Offset="1"/>
                                                </LinearGradientBrush>
                                            </Polyline.Stroke>
                                        </Polyline>
                                    </Canvas>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>
                </chartingToolkit:LineSeries.Style>
                <chartingToolkit:LineSeries.DataPointStyle>
                    <Style TargetType="chartingToolkit:LineDataPoint">
                        <Setter Property="Background" Value="Transparent" />
                    </Style>
                </chartingToolkit:LineSeries.DataPointStyle>
            </chartingToolkit:LineSeries>
            <chartingToolkit:Chart.LegendStyle>
                <Style TargetType="datavis:Legend">
                    <Setter Property="Width" Value="0" />
                </Style>
            </chartingToolkit:Chart.LegendStyle>
        </chartingToolkit:Chart>  
jsanalytics
  • 13,058
  • 4
  • 22
  • 43
L4c0573
  • 333
  • 1
  • 7
  • 23
  • Because they have different value ranges on theire axis. The y-values of chart 1 are up to 14.000, but the y-values of chart 2 are only between 0 and 35. So chart 2 would be shown as a line at the bottom of the chart, if I would display it at the same chart, – L4c0573 Apr 14 '16 at 09:06

1 Answers1

0

Instead of setting Color="Gray" which is #FF808080 you could try Color="#66808080". This way you are setting opacity to the color.

Daniel Filipov
  • 325
  • 4
  • 17