public void CreateLine(Grid oGrid, string sTitle, string sTableName, bool ifGetSig, string sYUint, string sYUint2, string sYTitle1, string sYTitle2, string sYTitle3, string[] sXLabel, double[] dYValue1, double[] dYValue2, double[] dYValue3)
        {

Chart chart = new MyChart();

chart.Width = 500;//宽
            chart.Height = 300;//高
            //chart.Margin = new Thickness(0, 20, 40, 0);
            chart.Margin = new Thickness(0, 0, 10, 20); //位置
            chart.ScrollingEnabled = false;
            chart.Name = sTableName;
            chart.DataPointWidth = 2.5;
            if (ifGetSig)
            {
                chart.MouseLeftButtonUp += new MouseButtonEventHandler(chart_MouseLeftButtonUp);
            }

Title title = new Title();
            title.Text = sTitle; //图表标题
            title.FontSize = 15;//图表标题字体大小
            chart.Titles.Add(title);

// X 坐标轴
            Axis axisX = new Axis();
            AxisLabels xal = new AxisLabels //X 坐标轴样式
            {
                //Enabled = true, //设置是否显示坐标轴上的文本,默认值为true
                //Angle = 45,//设置文本显示的角度,取值为 –90 至 90
                FontSize = 13//设置文字大小
            };
            axisX.AxisLabels = xal;
            chart.AxesX.Add(axisX);
            // Y 坐标轴
            Axis axisY = new Axis();
            AxisLabels yal = new AxisLabels  // Y 坐标轴样式
            {
                //Enabled = true, //设置是否显示坐标轴上的文本,默认值为true
                //Angle = 45,//设置文本显示的角度,取值为 –90 至 90
                FontSize = 13//设置文字大小
            };
            axisY.AxisLabels = yal;
            axisY.Title = sYUint; //Y坐标轴单位
            axisY.TitleFontSize = 14;//Y坐标轴单位字体大小
            chart.AxesY.Add(axisY);

title.MouseLeftButtonDown += new MouseButtonEventHandler(title_MouseLeftButtonDown);

// Y 坐标轴 双坐标轴
            Axis axisYT = new Axis() { AxisType = AxisTypes.Secondary };// 双坐标轴
            AxisLabels yalT = new AxisLabels
            {
                //Enabled = true, //设置是否显示坐标轴上的文本,默认值为true
                //Angle = 45,//设置文本显示的角度,取值为 –90 至 90
                FontSize = 13//设置文字大小
            };
            axisYT.AxisLabels = yalT;
            axisYT.Title = sYUint2; //双坐标轴单位
            axisYT.TitleFontSize = 14;//双坐标轴单位字体大小
            chart.AxesY.Add(axisYT);

////设置图标字体大小
            //Legend legend = new Legend();
            //legend.FontSize = 13;
            //chart.Legends.Add(legend);
            DataSeries dataSeries1 = new DataSeries();
            dataSeries1.LegendText = sYTitle1;
            dataSeries1.RenderAs = RenderAs.Line;
            dataSeries1.AxisYType = AxisTypes.Primary;

DataSeries dataSeries2 = new DataSeries();
            dataSeries2.LegendText = sYTitle2;
            dataSeries2.RenderAs = RenderAs.Line;
            dataSeries2.AxisYType = AxisTypes.Primary;

DataSeries dataSeries3 = new DataSeries();
            dataSeries3.LegendText = sYTitle3;
            dataSeries3.RenderAs = RenderAs.Line;
            dataSeries3.AxisYType = AxisTypes.Secondary;

DataPoint dp1;
            DataPoint dp2;
            DataPoint dp3;

for (int i = 0; i < sXLabel.Length; i++)
            {
                dp1 = new DataPoint();
                dp2 = new DataPoint();
                dp3 = new DataPoint();

dp1.AxisXLabel = sXLabel[i];
                dp1.YValue = dYValue1[i];
                dataSeries1.DataPoints.Add(dp1);

dp2.AxisXLabel = sXLabel[i];
                dp2.YValue = dYValue2[i];
                dataSeries2.DataPoints.Add(dp2);

dp3.AxisXLabel = sXLabel[i];
                dp3.YValue = dYValue3[i];
                dataSeries3.DataPoints.Add(dp3);
            }
            chart.Series.Add(dataSeries1);
            chart.Series.Add(dataSeries2);
            chart.Series.Add(dataSeries3);
            oGrid.Children.Add(chart);

}

silverlight 双坐标轴的更多相关文章

  1. visifire 图表双坐标轴 silverlight

    public void CreateChart(Grid oGrid, ObservableCollection<ListItem> lBaseOilBar)        {       ...

  2. MATLAB绘图,绘双坐标轴,绘一图二轴等

    clc; clear all; close all; % %% 画极坐标系 % x = 0:.01 * pi:0.5 * pi; % y = cos(x) + sqrt(-1) * sin(x); % ...

  3. Origin双坐标轴图表

    1.空白处右键Add New Colume添加新列 2.全选各个列绘制图表 3.添加新的Y轴图层Graph—New Layer—Right-Y 4.右键左上角图层2 –Layer Contents 绑 ...

  4. matlab双坐标轴设定

    clc; clear all; close all; x1 = 0:.1:40; y1 = 4 * cos(x1)./(x1 + 2); x2 = 1:.2:20; y2 = x2.^2 ./ x2. ...

  5. silverlight visifire控件图表制作——silverlight 后台方法画图

    1.调用wcf 获取信息 private void svc_GetSingleChartDataCompleted(object sender, GetSingleChartDataCompleted ...

  6. Matplotlib绘图双纵坐标轴设置及控制设置时间格式

    双y轴坐标轴图 今天利用matplotlib绘图,想要完成一个双坐标格式的图. fig=plt.figure(figsize=(20,15)) ax1=fig.add_subplot(111) ax1 ...

  7. matlab 将多个盒图放在一张图上

    1.boxplot 将多个盒图放在一张图上 x1 = normrnd(5,1,100,1)';x2 = normrnd(6,1,200,1)';X = [x1 x2];G = [zeros(size( ...

  8. Maltab命令(随用随更新)

    1.eval() ------ 将括号内的字符串视为语句并运行 比如eval('y1=sin(2)')和语句y1=sin(2)等价 多在循环中使用,可以对多个名字有规则的变量或文件进行操作,比如 fo ...

  9. Python画图笔记

    matplotlib的官方网址:http://matplotlib.org/ 问题 Python Matplotlib画图,在坐标轴.标题显示这五个字符 ⊥ + - ⊺ ⨁,并且保存后也能显示   h ...

随机推荐

  1. uCgui和emWin的区别

              在国内做嵌入式系统的,开始入门OS的时候,大家应该都会选择uC/OS,为什么?因为代码开源且资料众多嘛.由于uC/OS的原因大家也一定接触了uC/GUI的嵌入式图形软件库.其实uC ...

  2. [Oracle] 浅谈Sequence

    Oracle的Sequence是一种数据库对象,它可以生成有序数字,主要用于主键的自动生成.如果没有Sequence,主键的自动生成必须得在代码逻辑里实现,大致过程是:获取当前主键值,新主键值=当前主 ...

  3. sql 查找数据库中某字符串所在的表及字段

    declare   @str   varchar(100)     set   @str='是否严格控制'     --要搜索的字符串         declare   @s   varchar(8 ...

  4. js和jquery中的触发事件

    改别人的坑,遇到jquery选择器和fireEvent混用,不认识fireEvent方法报错. js的方法不能使用jquery的选择器去调用. 1.fireEvent (IE上的js方法 ) 我们来看 ...

  5. php 之 类,对象

    --恢复内容结束--- 一.类和对象: 1.定义: 对象:我们所见到的东西都可以称之为对象,是类实例化出来的东西 类:是对所有的同类对象抽象出来的东西 eg: 在一张表中记录了全班同学的学号,姓名,性 ...

  6. WEB开发中常用的正则表达式

    在计算机科学中,正则表达式用来描述或者匹配一系列符合某个句法规则的字符串的单个字符串.在WEB开发中,正则表达式通常用来检测.查找替换某些符合规则的字符串,如检测用户输入E-mai格式是否正确,采集符 ...

  7. Python 基础教程中的问题及解决方案(1)

    1. 在ubuntu中,调用终端时如: f = open('/home/theone/test_input.txt', 'r') 中的txt格式文本不能加后缀 正确的应为:  f = open('/h ...

  8. NAMESPACE

    限定作用域,比类高,比文件低. cpp 和 h 里面都要用到.

  9. laravel实现第三方登录(qq登录)

    首先composer安装依赖: composer require socialiteproviders/qq 注册服务提供者(同时注释掉原有的Socialite提供者): 'providers' =& ...

  10. 理想与现实——观电影《Dead Poets Society》有感

    我们每一个人都注定要死去,看看那些旧照片,照片里的年轻人现在都在哪里呢?也许有的人曾经充满活力,曾经信誓旦旦地要去改变这个世界,但如今却变得只知道顺从,如果你去问他们,他们会说:大概这就是现实吧. 现 ...