码迷,mamicode.com
首页 > 其他好文 > 详细

WPF Toolkit Chart--多Y轴显示

时间:2014-05-14 23:40:51      阅读:844      评论:0      收藏:0      [点我收藏+]

标签:style   blog   class   code   java   c   

效果:

bubuko.com,布布扣

 

bubuko.com,布布扣
<Window x:Class="Chart.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525"         
        xmlns:tk="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit" Loaded="Window_Loaded">
    <Grid>
        <tk:Chart Name="chart1" Title="Chart Title" >
            <tk:Chart.Axes>
                <tk:LinearAxis Orientation="X" Interval="1" Title="次数"></tk:LinearAxis>
            </tk:Chart.Axes>
            <tk:LineSeries x:Name="line1" DependentValuePath="Value" IndependentValuePath="Key">
                <tk:LineSeries.DependentRangeAxis>
                    <tk:LinearAxis Orientation="Y" Interval="10" Minimum="0" Maximum="100" Title="Series1"></tk:LinearAxis>
                </tk:LineSeries.DependentRangeAxis>
            </tk:LineSeries>
            <tk:LineSeries x:Name="line2" DependentValuePath="Value" IndependentValuePath="Key">
                <tk:LineSeries.DependentRangeAxis>
                    <tk:LinearAxis Orientation="Y" Interval="100" Title="Series2"></tk:LinearAxis>
                </tk:LineSeries.DependentRangeAxis>
            </tk:LineSeries>
            <tk:LineSeries x:Name="line3" DependentValuePath="Value" IndependentValuePath="Key">
                <tk:LineSeries.DependentRangeAxis>
                    <tk:LinearAxis Orientation="Y" Interval="1000" Title="Series3"></tk:LinearAxis>
                </tk:LineSeries.DependentRangeAxis>
            </tk:LineSeries>
        </tk:Chart>
    </Grid>
</Window>
bubuko.com,布布扣

 

bubuko.com,布布扣
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Chart
{
    /// <summary>
    /// MainWindow.xaml 的交互逻辑
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            Dictionary<int, int> d = new Dictionary<int, int>();
            d.Add(1, 50);
            d.Add(2, 40);
            d.Add(3, 50);
            d.Add(4, 40);
            d.Add(5, 50);

            line1.ItemsSource = d;

            Dictionary<int, int> d1 = new Dictionary<int, int>();
            d1.Add(1, 100);
            d1.Add(2, 200);
            d1.Add(3, 300);
            d1.Add(4, 400);
            d1.Add(5, 500);

            line2.ItemsSource = d1;

            Dictionary<int, int> d2 = new Dictionary<int, int>();
            d2.Add(1, 1000);
            d2.Add(2, 3000);
            d2.Add(3, 4000);
            d2.Add(4, 2000);
            d2.Add(5, 5000);

            line3.ItemsSource = d2;
        }


    }
}
bubuko.com,布布扣

 

WPF Toolkit Chart--多Y轴显示,布布扣,bubuko.com

WPF Toolkit Chart--多Y轴显示

标签:style   blog   class   code   java   c   

原文地址:http://www.cnblogs.com/amw2738/p/3728705.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!