首页 > 其他 > 详细

Devexpress WPF ChartControl 多Y轴

时间:2014-05-19 11:53:17      阅读:771      评论:0      收藏:0      [点我收藏+]

bubuko.com,布布扣

 

bubuko.com,布布扣
<Window
    x:Class="DXApplication4.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:dxc="http://schemas.devexpress.com/winfx/2008/xaml/charts"
        xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
        Title="MainWindow" Height="350" Width="525" 
    
    >
    <Grid>
        <dxc:ChartControl >
            <dxc:XYDiagram2D x:Name="diagram1">
                <dxc:XYDiagram2D.SecondaryAxesY>
                    <dxc:SecondaryAxisY2D x:Name="y2">
                        <dxc:SecondaryAxisY2D.Title>
                            <dxc:AxisTitle Content="y2"></dxc:AxisTitle>
                        </dxc:SecondaryAxisY2D.Title>
                    </dxc:SecondaryAxisY2D>
                    <dxc:SecondaryAxisY2D x:Name="y3"/>
                </dxc:XYDiagram2D.SecondaryAxesY>
                <dxc:XYDiagram2D.AxisX>
                    <dxc:AxisX2D />
                </dxc:XYDiagram2D.AxisX>
                <dxc:XYDiagram2D.AxisY>
                    <dxc:AxisY2D  >
                        <dxc:AxisY2D.Range>
                            <dxc:AxisRange MaxValue="10" MinValue="0"></dxc:AxisRange>
                        </dxc:AxisY2D.Range>
                    </dxc:AxisY2D>      
                </dxc:XYDiagram2D.AxisY>
                <dxc:LineSeries2D  ArgumentDataMember="Key" ValueDataMember="Value" x:Name="series1"/>
                <dxc:LineSeries2D dxc:XYDiagram2D.SeriesAxisY="{Binding ElementName=y2}" ArgumentDataMember="Key" ValueDataMember="Value" x:Name="series2"/>          
                <dxc:LineSeries2D  ArgumentDataMember="Key" ValueDataMember="Value" x:Name="series3">
                    <dxc:XYDiagram2D.SeriesAxisY>
                        <Binding ElementName="y3"/>
                    </dxc:XYDiagram2D.SeriesAxisY>
                </dxc:LineSeries2D>
            </dxc:XYDiagram2D>
        </dxc:ChartControl>
    </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.Shapes;
using DevExpress.Xpf.Charts;
using System.Data;


namespace DXApplication4
{
    public partial class MainWindow : Window
    {
        public MainWindow ()
        {
            InitializeComponent();

            Dictionary<int, int> d1 = new Dictionary<int, int>();
            d1.Add(1, 1);
            d1.Add(2, 2);
            d1.Add(3, 3);
            d1.Add(4, 4);

            series1.DataSource = d1;
            SecondaryAxisY2D y1 = new SecondaryAxisY2D();            
            y1.Title = new AxisTitle() { Content = "y1" };
            y1.Range = new AxisRange() { MaxValue = 10, MinValue = 0 };
            diagram1.SecondaryAxesY.Remove(y1);
            diagram1.SecondaryAxesY.Add(y1);           
            XYDiagram2D.SetSeriesAxisY(series1, y1);

            Dictionary<int, int> d2 = new Dictionary<int, int>();
            d2.Add(1, 2);
            d2.Add(2, 4);
            d2.Add(3, 7);
            d2.Add(4, 9);
            series2.DataSource = d2;

            Dictionary<int, int> d3 = new Dictionary<int, int>();
            d3.Add(1, 1);
            d3.Add(2, 5);
            d3.Add(3, 2);
            d3.Add(4, 8);
            series3.DataSource = d3;

        }
       
    
    }


}
bubuko.com,布布扣

 

Devexpress WPF ChartControl 多Y轴,布布扣,bubuko.com

Devexpress WPF ChartControl 多Y轴

原文:http://www.cnblogs.com/amw2738/p/3734798.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!