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. 关于textView的字数限制

    在一个项目中遇到texteView的字数限制,在iOS7.0上,会出现崩溃.我在这里栽了一个大跟头,废话不多说,下面直接贴代码吧. - (void)textViewDidChange:(UITextV ...

  2. php时间戳与时间转换

    PHP时间大的来分有两种,一是时间戳类型(1228348800),二是正常日期格式(2008-12-4) 所以存到数据库也有两种形式了(真正不止,我的应用就两种),时间戳类型我是保存为字符串的,这个是 ...

  3. mysql 5.6 参数详解

    系统变量提供的是各种与服务器配置和功能有关的信息.大部分的系统变量都可以在服务器启动时进行设置.在运行时,每一个系统变量都拥有一个全局值或会话值,或者同时拥有这两个值.许多系统变量都是动态的,也就是说 ...

  4. HTML元素遮挡Flash之梦

    wmode参数: transparent模式:可用z-index控制层级 opaque模式:可用z-index控制层级 window模式:flash层级在浏览器核心显示窗口之上,flash会盖住与他重 ...

  5. setf

    independent flags boolalpha read/write bool elements as alphabetic strings (true and false). showbas ...

  6. Java学习笔记--PriorityQueue(优先队列)(堆)

    PriorityQueue(优先队列)实际上是一个堆(不指定Comparator时默认为最小堆)队列既可以根据元素的自然顺序来排序,也可以根据 Comparator来设置排序规则.队列的头是按指定排序 ...

  7. 总结 xib

    总结 其实,你完全不需要做一个 “艰难的决定”,你可以像 QQ 和微信那样,根据具体情况来选择性的使用 xib 和 storyboard.这里有我的一些建议: 对于复杂的.动态生成的界面,建议使用手工 ...

  8. 使用QtScript库解析Json数组例子

    本文转载自:http://blog.sina.com.cn/s/blog_671732440100uwxh.html 使用qtscipt库解析json数组首先在工程文件中加 QT        += ...

  9. 短信,微信API(还能发邮件,短信,IM聊天)

    1.用于微信公众平台的Js API(WeixinApi) Github地址:https://github.com/zxlie/WeixinApi http://www.baidufe.com/item ...

  10. C++中,如何在标准库的std::string和常用库(Qt,VC等)的QString之间进行选择?

    假设一个场景:在写GUI程序的时候,如果GUI库和STL都提供了某个功能(比如容器字符串),应该如何在两个库之间选择? 做法是分层,比如分为frontend+core.开发core的时候只用STL,保 ...