• WPF Toolkit Chart--多Y轴显示


    效果:

    <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>
    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;
            }
    
    
        }
    }
  • 相关阅读:
    设计模式(3)——模版方法模式
    设计模式(2)——工厂模式
    设计模式(1)——单例模式
    哪些SQL语句不能用在事务中
    Max Degree of Parallelism最大并行度配置--缓解CPU压力
    IOC框架--AutoFac
    Log4Net日志详解
    Trace、Debug和TraceSource的使用以及日志设计
    c# System.Diagnostics命名空间--调试并跟踪代码日志
    数据分析必会的六大实用模型
  • 原文地址:https://www.cnblogs.com/amw2738/p/3728705.html
Copyright © 2020-2023  润新知