1

有没有办法改变 Visifire XAML 中饼图图例的垂直滚动查看器的滚动查看器样式?

这是我的代码:

<visifire:Chart x:Name="EmployeeMasterFileChart" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" BorderThickness="0" Background="{x:Null}" Margin="0,0,0,0" Padding="4,0,4,4" MaxWidth="500">
                        <visifire:Chart.PlotArea>
                            <visifire:PlotArea Background="Transparent" />
                        </visifire:Chart.PlotArea>
                        <visifire:Chart.Legends>
                            <visifire:Legend x:Name="Legend0" HorizontalAlignment="Left" VerticalAlignment="Center" EntryMargin="5"
                            Padding="10" FontSize="10" FontWeight="Normal" ShadowEnabled="False" BorderThickness="0" Background="Transparent" LightingEnabled="False"/>
                        </visifire:Chart.Legends>

                        <visifire:Chart.Titles>
                            <visifire:Title FontSize="12" Text="Title" Margin="0,10,0,0" />
                        </visifire:Chart.Titles>

                        <visifire:Chart.Series>

                            <visifire:DataSeries RenderAs="Pie" LabelEnabled="false" Bevel="True" ShadowEnabled="true" Cursor="Hand" 
                                LightingEnabled="False" BorderColor="DarkBlue" 
                                BorderThickness=".24" ShowInLegend="True" IncludePercentageInLegend="True">

                                <visifire:DataSeries.DataPoints> 
                                    <visifire:DataPoint AxisXLabel="Jan" YValue="5509"/> 
                                    <visifire:DataPoint AxisXLabel="Feb" YValue="2047"/> 
                                    <visifire:DataPoint AxisXLabel="Mar" YValue="10047"/> 
                                    <visifire:DataPoint AxisXLabel="Apr" YValue="8508"/> 
                                    <visifire:DataPoint AxisXLabel="May" YValue="6022"/> 
                                    <visifire:DataPoint AxisXLabel="Jun" YValue="9047"/> 
                                    <visifire:DataPoint AxisXLabel="Jul" YValue="7508"/> 
                                    <visifire:DataPoint AxisXLabel="Aug" YValue="5222"/> 
                                    <visifire:DataPoint AxisXLabel="Sep" YValue="3698"/> 
                                    <visifire:DataPoint AxisXLabel="Oct" YValue="5754"/> 
                                    <visifire:DataPoint AxisXLabel="Nov" YValue="8756"/> 
                                    <visifire:DataPoint AxisXLabel="Dec" YValue="2340"/> 
                                    <visifire:DataPoint AxisXLabel="Jan" YValue="5509"/> 
                                    <visifire:DataPoint AxisXLabel="Feb" YValue="2047"/> 
                                    <visifire:DataPoint AxisXLabel="Mar" YValue="10047"/> 
                                    <visifire:DataPoint AxisXLabel="Apr" YValue="8508"/> 
                                    <visifire:DataPoint AxisXLabel="May" YValue="6022"/> 
                                    <visifire:DataPoint AxisXLabel="Jun" YValue="9047"/> 
                                    <visifire:DataPoint AxisXLabel="Jul" YValue="7508"/> 
                                    <visifire:DataPoint AxisXLabel="Aug" YValue="5222"/> 
                                    <visifire:DataPoint AxisXLabel="Sep" YValue="3698"/> 
                                    <visifire:DataPoint AxisXLabel="Oct" YValue="5754"/> 
                                    <visifire:DataPoint AxisXLabel="Nov" YValue="8756"/> 
                                    <visifire:DataPoint AxisXLabel="Dec" YValue="2340"/> 
                                </visifire:DataSeries.DataPoints> 

                            </visifire:DataSeries>
                        </visifire:Chart.Series>
                    </visifire:Chart>
4

1 回答 1

3

我猜你想改变图例的垂直滚动查看器的 ScrollBar 样式

目前没有直接选项可以设置 Legend 中 Vertical ScrollViewer 中存在的垂直 ScrollBar 的样式。但是您可以尝试以下解决方法。

您只需要在 Chart 范围内为 ScrollBar 创建一个 Global 样式。为 ScrollBar 设置 Template 属性并根据需要进行修改。查看下面的示例。

在此处输入图像描述

XAML

 <vc:Chart Height="300" Width="500">
            <vc:Chart.Resources>
                <Style TargetType="ScrollBar">
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="ScrollBar">
                             ..................
                             ......Here you need to edit Template of the ScrollBar....
                             ..................
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>

            </vc:Chart.Resources>
            <vc:Chart.Titles>
                <vc:Title FontSize="12" Text="Title" Margin="0,10,0,0" />
            </vc:Chart.Titles>
            <vc:Chart.Legends>
                <vc:Legend HorizontalAlignment="Left"  VerticalAlignment="Center"></vc:Legend>
            </vc:Chart.Legends>

            <vc:Chart.Series>

                <vc:DataSeries RenderAs="Pie" LabelEnabled="false" Bevel="True" ShadowEnabled="true" Cursor="Hand" 
                    LightingEnabled="False" BorderColor="DarkBlue" 
                    BorderThickness=".24" ShowInLegend="True" IncludePercentageInLegend="True">

                    <vc:DataSeries.DataPoints>
                        <vc:DataPoint AxisXLabel="Jan" YValue="5509"/>
                        <vc:DataPoint AxisXLabel="Feb" YValue="2047"/>
                        <vc:DataPoint AxisXLabel="Mar" YValue="10047"/>
                        <vc:DataPoint AxisXLabel="Apr" YValue="8508"/>
                        <vc:DataPoint AxisXLabel="May" YValue="6022"/>
                        <vc:DataPoint AxisXLabel="Jun" YValue="9047"/>
                        <vc:DataPoint AxisXLabel="Jul" YValue="7508"/>
                        <vc:DataPoint AxisXLabel="Aug" YValue="5222"/>
                        <vc:DataPoint AxisXLabel="Sep" YValue="3698"/>
                        <vc:DataPoint AxisXLabel="Oct" YValue="5754"/>
                        <vc:DataPoint AxisXLabel="Nov" YValue="8756"/>
                        <vc:DataPoint AxisXLabel="Dec" YValue="2340"/>
                        <vc:DataPoint AxisXLabel="Jan" YValue="5509"/>
                        <vc:DataPoint AxisXLabel="Feb" YValue="2047"/>
                        <vc:DataPoint AxisXLabel="Mar" YValue="10047"/>
                        <vc:DataPoint AxisXLabel="Apr" YValue="8508"/>
                        <vc:DataPoint AxisXLabel="May" YValue="6022"/>
                        <vc:DataPoint AxisXLabel="Jun" YValue="9047"/>
                        <vc:DataPoint AxisXLabel="Jul" YValue="7508"/>
                        <vc:DataPoint AxisXLabel="Aug" YValue="5222"/>
                        <vc:DataPoint AxisXLabel="Sep" YValue="3698"/>
                        <vc:DataPoint AxisXLabel="Oct" YValue="5754"/>
                        <vc:DataPoint AxisXLabel="Nov" YValue="8756"/>
                        <vc:DataPoint AxisXLabel="Dec" YValue="2340"/>
                    </vc:DataSeries.DataPoints>

                </vc:DataSeries>
            </vc:Chart.Series>
        </vc:Chart>

您可以从下面的链接下载setting-scrollbar-style-in-legend-workarround.zip文件。

https://skydrive.live.com/?cid=61995e3895be1728&sc=documents&id=61995E3895BE1728%21125#

于 2011-09-15T11:52:13.070 回答