• silverlight 双坐标轴


      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);

            }

  • 相关阅读:
    jQuery常用 遍历函数
    JS针对pc页面固定宽度在手机展示问题 <meta ...>
    关于窗口的一些小脚本
    关于 注册页面浏览器自动添加账号密码问题?
    一个完整的html 每个标签的含义
    rem与@media 的优缺点
    关于IE浏览器的一些思路
    jq 动态添加.active 实现导航效果
    CSS 常用样式 提高网页编写速度
    html5与js关于input[type='text']文本框value改变触发事件一些属性的区别oninput,onpropertychange,onchange和文本框的value点击全选状态onclick="select();"。做购物车页面时会要用到。
  • 原文地址:https://www.cnblogs.com/xuxin-1989/p/3695675.html
Copyright © 2020-2023  润新知