我制作了两张图表。在他们两个是一个单线图。它们在x轴和y轴上具有不同的值。但我想同时向他们展示。所以我必须使第二个图表的背景和轴透明。只有该行应保持可见,以便我可以在第一个图表中看到它。然而,对于第二张图表,轴不再正确无关紧要。
这是我已编码的XAML。如何将背景和轴更改为透明或隐藏?:
<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>
答案 0 :(得分:0)
而不是设置Color =&#34; Gray&#34;这是#FF808080你可以试试Color =&#34;#66808080&#34;。这样就可以将颜色设置为不透明度。