• silverlight .net后台 设置visifire控件图表样式 属性说明


       .net后台 代码: 如图

             Chart chart = new MyCharts();  //图表
                //chart.Watermark = false;  //没好使
                chart.Width = 500; //图表宽
                chart.Height = 300;//图表高
                chart.ScrollingEnabled = false;
                chart.Name = sTableName;
                chart.DataPointWidth = 1.8; //柱状图中柱子的宽度 = 图表宽*1.8%
                //chart.FontSize = 20;
                //chart.
                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 = 15//设置文字大小
                };
                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 = 15//设置文字大小
                };
                axisY.AxisLabels = yal;
                axisY.Title = sYUint; // Y 坐标轴说明文字
                axisY.TitleFontSize = 15;// Y 坐标轴说明文字字体大小

                axisY.AxisMinimum = 0;// Y 坐标轴最小值

                axisY.AxisMaximum = 100; // Y轴坐标轴最大值

                chart.AxesY.Add(axisY);

                title.MouseLeftButtonDown += new MouseButtonEventHandler(title_MouseLeftButtonDown);

          //设置图标样式 Legend 

          Legend legend = new Legend();
        legend.FontSize = 20;
        chart.Legends.Add(legend);


                DataSeries dataSeries1 = new DataSeries();
                //dataSeries1.LegendText = sYTitle1;
                dataSeries1.LegendText = sYTitle1; //图表的图标说明
                dataSeries1.LabelFontSize = 20;//设置图标字体大小

    //LabelAngle = oYAXIS.LabelAngle;
    dataSeries.LabelAngle =-30;// Convert.ToDouble(LabelAngle);//设置坐标点数据倾斜角度(-90至90)
    //dataSeries.ShowInLegend = true; //是否显示坐标点数据的图标 
    dataSeries.LabelEnabled = true; //是否显示坐标点数据
    dataSeries.LabelFontSize = 12;//设置图标(显示数据)字体大小
    dataSeries.LabelStyle = LabelStyles.Inside;//数据内嵌


                dataSeries1.RenderAs = RenderAs.Column;

                DataSeries dataSeries2 = new DataSeries();
                //dataSeries2.LegendText = sYTitle2;
                dataSeries2.LegendText = sYTitle2;
                dataSeries2.LabelFontSize = 20;
                dataSeries2.RenderAs = RenderAs.Column;

                DataSeries dataSeries3 = new DataSeries();
                dataSeries3.LabelFontSize = 20;
                //dataSeries3.LegendText = sYTitle3;
                dataSeries3.LegendText = sYTitle3;
                dataSeries3.RenderAs = RenderAs.Column;

                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.LabelText
                    dp1.YValue = dYValue1[i];
                    //if (ifGetSig)
                    //{
                    //    dp1.LabelText = sTableName;
                    //    dp1.MouseLeftButtonUp += new MouseButtonEventHandler(dataPoint_MouseLeftButtonUp);
                    //}
                    dataSeries1.DataPoints.Add(dp1);

                    dp2.AxisXLabel = sXLabel[i];
                    dp2.YValue = dYValue2[i];
                    //if (ifGetSig)
                    //{
                    //    dp2.LabelText = sTableName;
                    //    dp2.MouseLeftButtonUp += new MouseButtonEventHandler(dataPoint_MouseLeftButtonUp);
                    //}
                    dataSeries2.DataPoints.Add(dp2);

                    dp3.AxisXLabel = sXLabel[i];
                    dp3.YValue = dYValue3[i];
                    //if (ifGetSig)
                    //{
                    //    dp3.LabelText = sTableName;
                    //    dp3.MouseLeftButtonUp += new MouseButtonEventHandler(dataPoint_MouseLeftButtonUp);
                    //}
                    dataSeries3.DataPoints.Add(dp3);
                }

                chart.Series.Add(dataSeries1);
                chart.Series.Add(dataSeries2);
                chart.Series.Add(dataSeries3);
                oGrid.Children.Add(chart);

    下图转载http://www.cnblogs.com/chengxingliang/archive/2011/02/26/1965831.html

     

  • 相关阅读:
    20171017/20171018
    BZOJ[3193] [JLOI2013]地形生成
    BZOJ[1009] [HNOI2008]GT考试
    BZOJ[4767] 两双手
    BZOJ[4013] [HNOI2015]实验比较
    BZOJ[1925] [Sdoi2010]地精部落
    20171015 杂题
    20171015
    20171014
    USACO 2015 December Contest, Gold Problem 3. Bessie's Dream
  • 原文地址:https://www.cnblogs.com/xuxin-1989/p/3664146.html
Copyright © 2020-2023  润新知