zoukankan      html  css  js  c++  java
  • SilverLigth的Chart不要图例(Legend)的方法

    XMAL方式:

     1         <chartingToolkit:Chart x:Name="SamplePercentageChart"  Grid.Row="0"
    2 DataContext="{Binding ElementName=PieSampleUserControl}" >
    3
    4 <chartingToolkit:PieSeries DependentValueBinding="{Binding Percentage}"
    5 ItemsSource="{Binding PieSlices}"
    6 IndependentValueBinding="{Binding }"
    7 >
    8
    9 </chartingToolkit:PieSeries>
    10
    11 <chartingToolkit:Chart.LegendStyle>
    12 <Style TargetType="datavis:Legend">
    13 <Setter Property="Width" Value="0"/>
    14 <Setter Property="Height" Value="0"/>
    15 </Style>
    16 </chartingToolkit:Chart.LegendStyle>
    17
    18 </chartingToolkit:Chart>

    C#代码:

    1                 Chart chart = new Chart { Title = new TextBlock() { Text = di.Key, TextWrapping = TextWrapping.Wrap }, Width = 350, Height = 300, Margin = new Thickness(20, 20, 0, 0) };
    2 Style style = new Style(typeof(Legend));
    3 style.Setters.Add(new Setter(Legend.WidthProperty, 0));
    4 style.Setters.Add(new Setter(Legend.HeightProperty, 0));
    5 chart.LegendStyle = style;


    定制X轴和Y轴量程和标题等方法

    XAML方式:

                   <DVC:ScatterSeries  Title=""         
    IndependentValueBinding
    ="{Binding Path=Key}"
    DependentValueBinding
    ="{Binding Path=Value}"
    >
    <DVC:ScatterSeries.IndependentAxis >
    <DVC:LinearAxis
    Title="Prices"
    Orientation
    ="X" Maximum="6.5" Minimum="2">

    </DVC:LinearAxis>
    </DVC:ScatterSeries.IndependentAxis>

    C#代码:

                    CategoryAxis xAxis = new CategoryAxis { Orientation = AxisOrientation.X, Title = "(年)" };
    chart.Axes.Add(xAxis);

    LinearAxis yAxis = new LinearAxis { Orientation = AxisOrientation.Y, Location = AxisLocation.Left, Title = "(%)", ShowGridLines = true, Minimum = 0, Maximum = 100 };
    chart.Axes.Add(yAxis);

    LineSeries ls = new LineSeries();
    ls.Title = string.Empty;
    ls.IndependentValueBinding = new Binding("Name");
    ls.DependentValueBinding = new Binding("Value");
    ls.ItemsSource = di.Items;

    ls.IndependentAxis = xAxis;
    ls.DependentRangeAxis = yAxis;




  • 相关阅读:
    从零开始学安全(七)●Linux基础命令学习笔记
    从零开始学安全(六)●黑客常用的Dos命令
    ABAP
    ABAP modify screen:修改屏幕,实现隐藏、禁止输入字段
    C#以对象为成员的例子
    C#构造函数、属性的应用
    C#属性方法 构造函数(不知道自己理解的对不对)
    C#斐波那契数列求法(比较阶乘和循环所用时间)
    C#函数的递归
    C#函数的参数传递2(refout)
  • 原文地址:https://www.cnblogs.com/chriskwok/p/2195624.html
Copyright © 2011-2022 走看看