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

            }

  • 相关阅读:
    MPS和MRP之间有什么样的关系呢
    java中静态代码块详解
    SQL server 分组后每组取出任意一行
    人是否能成功,其实可能很早就能看出来
    国内外产品经理的区别
    Yarn 和 NPM 国内快速镜像(淘宝镜像)
    vue-cli 使用less 遇到的问题 || vue-cli 使用less
    布隆过滤器
    PHP性能优化
    Redis-高并发代言词,为什么做分布式要Redis?
  • 原文地址:https://www.cnblogs.com/xuxin-1989/p/3695675.html
Copyright © 2020-2023  润新知