当前位置: 首页>>代码示例>>C#>>正文


C# Series.ChangeView方法代码示例

本文整理汇总了C#中Series.ChangeView方法的典型用法代码示例。如果您正苦于以下问题:C# Series.ChangeView方法的具体用法?C# Series.ChangeView怎么用?C# Series.ChangeView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Series的用法示例。


在下文中一共展示了Series.ChangeView方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InitChart

        /// <summary>
        /// ��ʼ��ͳ��ͼ
        /// </summary>
        /// <param name="useKind"></param>
        private void InitChart(int useKind)
        {
            Series series1 = new Series();

            DataTable dtResult = null;
            if (useKind == 0)
            {
                dtResult = StateApp.BuilderRuleStyleTable();
            }
            else
            {
                dtResult = StateApp.BuilderLayerStyleTable();
            }

            ReportListView.DataSource = null;
            gridViewMain.Columns.Clear();

            DataRow pRow = dtResult.NewRow();
            if (useKind == 0)
                pRow["�������"] = "�ܼ�";
            else
                pRow["ͼ��"] = "�ܼ�";
            pRow["����ȱ��"] = dtResult.Compute("sum(����ȱ��)", "");
            pRow["��ȱ��"] = dtResult.Compute("sum(��ȱ��)", "");
            pRow["��ȱ��"] = dtResult.Compute("sum(��ȱ��)", "");

            if (pRow["����ȱ��"] is DBNull || pRow["��ȱ��"] is DBNull || pRow["��ȱ��"] is DBNull)
            {
                btnExport.Enabled = dtResult.Rows.Count > 0;
                ReportListView.DataSource = dtResult;
                return;
            }
            double mark = StateApp.GetResultMark(dtResult);
            if (mark < 50)
                labelControlMark.Text = "�÷ֵ���50��";
            else
                labelControlMark.Text = "�÷�:" + mark;

            pRow["����ϼ�"] = Convert.ToInt32(pRow["����ȱ��"]) + Convert.ToInt32(pRow["��ȱ��"]) + Convert.ToInt32(pRow["��ȱ��"]);

            int nErrorCount = Convert.ToInt32(pRow["����ϼ�"]);
            if (useKind == 0)
            {
                foreach (DataRow dr in dtResult.Rows)
                {
                    SeriesPoint pPoint = new SeriesPoint();
                    long lcount = Convert.ToInt32(dr["����ϼ�"]);

                    if (lcount > 0)
                    {
                        double temp = (lcount*100.0)/nErrorCount;

                        pPoint.Argument = dr["�������"] + ":" + temp.ToString("f1") + "%";
                        pPoint.Values = new double[] {lcount};

                        series1.Points.Add(pPoint);
                    }
                }
            }
            else
            {
                foreach (DataRow dr in dtResult.Rows)
                {
                    SeriesPoint pPoint = new SeriesPoint();
                    long lcount = Convert.ToInt32(dr["����ϼ�"]);
                    if (lcount > 0)
                    {
                        double temp = (lcount*100.0)/nErrorCount;

                        pPoint.Argument = dr["ͼ��"] + ":" + temp.ToString("f1") + "%";
                        pPoint.Values = new double[] {lcount};
                        series1.Points.Add(pPoint);
                    }
                }
            }

            series1.ChangeView(ViewType.Pie);
            series1.PointOptions.ValueNumericOptions.Format = NumericFormat.FixedPoint;

            series1.PointOptions.ValueNumericOptions.Precision = 2;
            series1.PointOptions.PointView = PointView.Argument;

            PieSeriesLabel label = series1.Label as PieSeriesLabel;
            label.Position = PieSeriesLabelPosition.Outside;
            label.TextColor = Color.Empty;

            series1.ShowInLegend = false;

            //OverlappingOptions options = series1.Label.OverlappingOptions;
            //options.ResolveOverlapping = true;

            //chartControl1.Series.Clear();
            //chartControl1.Series.Add(series1);

            dtResult.Rows.Add(pRow);

//.........这里部分代码省略.........
开发者ID:hy1314200,项目名称:HyDM,代码行数:101,代码来源:frmAppraise.cs

示例2: LoadGraph

        public void LoadGraph()
        {
            int t1 = System.Environment.TickCount;

            if (_report.State != Report.StateEnum.Executed)
                return;

            _chCtrl.BeginInit();

            bool rotateGraph = false;
            bool pivotAxes = ((_report.GraphOptions & OlapReport.GraphOptionsEnum.Pivot) > 0);

            int seriesPosCount = (pivotAxes ? _report.Cellset.Axis1PosCount : _report.Cellset.Axis0PosCount);
            int seriesMemCount = (pivotAxes ? _report.Cellset.Axis1TupleMemCount : _report.Cellset.Axis0TupleMemCount);
            int catPosCount = (pivotAxes ? _report.Cellset.Axis0PosCount : _report.Cellset.Axis1PosCount);
            int catMemCount = (pivotAxes ? _report.Cellset.Axis0TupleMemCount : _report.Cellset.Axis1TupleMemCount);
            if (seriesPosCount == 0 || catPosCount == 0)
                return;

            Size size = new Size(_report.GraphWidth, _report.GraphHeight);
            size = this.AdjustGraphWidth(size, _report.GraphType);

            // limit number of series
            if (seriesPosCount > __MaxSeriesCount)
                seriesPosCount = __MaxSeriesCount;
            if (_report.GraphType == OlapReport.GraphTypeEnum.Pie || _report.GraphType == OlapReport.GraphTypeEnum.PieBrokenApart)
                if (seriesPosCount > __MaxPieCount)
                    seriesPosCount = __MaxPieCount;

            // limit number of categories
            if (catPosCount > __MaxCategoriesCount)
                catPosCount = __MaxCategoriesCount;

            bool showValues = (_report.GraphOptions & OlapReport.GraphOptionsEnum.ShowValues) > 0;
            bool showSeries = (_report.GraphOptions & OlapReport.GraphOptionsEnum.ShowSeries) > 0;
            bool showCats = (_report.GraphOptions & OlapReport.GraphOptionsEnum.ShowCategories) > 0;
            bool setScaling = _report.GraphType != OlapReport.GraphTypeEnum.Pie && ((_report.GraphOptions & OlapReport.GraphOptionsEnum.ScalingBySeries) > 0);
            bool setPerc = !setScaling && ((_report.GraphOptions & OlapReport.GraphOptionsEnum.PercentByCategories) > 0);
            byte graphPieColumns = (_report.GraphPieColumns == 0 ?
                Convert.ToByte(Math.Sqrt(seriesPosCount)) : _report.GraphPieColumns);
            byte graphMixedLinePos = _report.GraphMixedLinePosition;
            graphMixedLinePos = (graphMixedLinePos <= 0 || graphMixedLinePos > seriesPosCount ? (byte)1 : graphMixedLinePos);

            // theme
            if (_report.GraphTheme != null && _report.GraphTheme != "")
                _chCtrl.AppearanceName = _report.GraphTheme;

            // create series
            for (int i = 0; i < seriesPosCount; i++)
            {
                string name = "";
                for (int j = 0; j < seriesMemCount; j++)
                    name += (j == 0 ? "" : " | ") + (pivotAxes ? _report.Cellset.GetCellsetMember(1, j, i).Name : _report.Cellset.GetCellsetMember(0, j, i).Name);

                Series series = new Series();
                series.Name = name;

                // type
                if (_report.GraphType == OlapReport.GraphTypeEnum.Pie || _report.GraphType == OlapReport.GraphTypeEnum.PieBrokenApart)
                {
                    // if pie, each of series is displayed as individual graph
                    if (_report.GraphType == OlapReport.GraphTypeEnum.PieBrokenApart)
                        _chCtrl.Series.Clear();
                    _chCtrl.Series.Add(series);

                    series.ChangeView(ViewType.Pie);

                    PiePointOptions ppo = (PiePointOptions)series.PointOptions;
                    PieSeriesView psw = (PieSeriesView)series.View;
                    PieSeriesLabel psl = (PieSeriesLabel)series.Label;

                    psl.Position = PieSeriesLabelPosition.TwoColumns;
                    series.PointOptions.PointView = PointView.Undefined;

                    if (_report.GraphType == OlapReport.GraphTypeEnum.Pie)
                    {
                        SimpleDiagram sd = new SimpleDiagram();
                        sd.LayoutDirection = LayoutDirection.Horizontal;
                        sd.Dimension = graphPieColumns;
                        _chCtrl.Diagram = sd;
                    }

                    // legend
                    if (showCats)
                        _chCtrl.Legend.Visible = false;

                    series.Label.OverlappingOptions.ResolveOverlapping = true;
                    series.LegendPointOptions.PointView = PointView.Argument;

                    _chCtrl.Legend.AlignmentHorizontal = LegendAlignmentHorizontal.Center;
                    _chCtrl.Legend.AlignmentVertical = LegendAlignmentVertical.BottomOutside;
                    _chCtrl.Legend.Direction = LegendDirection.LeftToRight;

                    // series title
                    SeriesTitle sTitle = new SeriesTitle();
                    sTitle.Text = name;
                    sTitle.Alignment = StringAlignment.Center;
                    sTitle.Dock = ChartTitleDockStyle.Bottom;
                    psw.Titles.Add(sTitle);
                }
//.........这里部分代码省略.........
开发者ID:GermanGlushkov,项目名称:FieldInformer,代码行数:101,代码来源:GraphControl.ascx.cs

示例3: LoadGraph

        public void LoadGraph()
        {
            if(_report.State!=Report.StateEnum.Executed)
                return;

            bool rotateGraph=false;
            bool rotateAxes=((_report.GraphOptions & OlapReport.GraphOptionsEnum.RotateAxes)>0);

            int seriesPosCount=(rotateAxes ? _report.Cellset.Axis1PosCount: _report.Cellset.Axis0PosCount);
            int seriesMemCount=(rotateAxes ? _report.Cellset.Axis1TupleMemCount: _report.Cellset.Axis0TupleMemCount);
            int catPosCount=(rotateAxes ? _report.Cellset.Axis0PosCount: _report.Cellset.Axis1PosCount);
            int catMemCount=(rotateAxes ? _report.Cellset.Axis0TupleMemCount: _report.Cellset.Axis1TupleMemCount);

            if(seriesPosCount>256)
                seriesPosCount=256;

            if(catPosCount>1024)
                catPosCount=1024;

            bool showValues=(_report.GraphOptions & OlapReport.GraphOptionsEnum.ShowValues)>0;
            bool showSeries=(_report.GraphOptions & OlapReport.GraphOptionsEnum.ShowSeries)>0;
            bool showCats=(_report.GraphOptions & OlapReport.GraphOptionsEnum.ShowCategories)>0;
            bool setScaling=(_report.GraphOptions & OlapReport.GraphOptionsEnum.SetScaling)>0;

            // create series
            for(int i=0;i<seriesPosCount;i++)
            {
                string name="";
                for(int j=0; j<seriesMemCount;j++)
                    name+=(j==0 ? "" : " | ")+ (rotateAxes ? _report.Cellset.GetCellsetMember(1, j, i).Name : _report.Cellset.GetCellsetMember(0, j, i).Name);

                Series series=new Series();
                series.Name=name;
                _chCtrl.Series.Add(series);

                // type
                if(_report.GraphType==OlapReport.GraphTypeEnum.Pie)
                {
                    // limit number of series
                    if(seriesPosCount>6)
                        seriesPosCount=6;

                    // disable scaling for pie
                    setScaling=false;

                    series.ChangeView(ViewType.Pie);

                    PiePointOptions ppo=(PiePointOptions)series.PointOptions;
                    PieSeriesView psw=(PieSeriesView)series.View;
                    PieSeriesLabel psl=(PieSeriesLabel)series.Label;

                    psl.Position=PieSeriesLabelPosition.TwoColumns;
                    series.ShowInLegend=false; // cause it's shown in pie anyway
                    showValues=true;
                    showCats=true;

                    this.chkCat.Checked=true;
                    this.chkCat.Disabled=true;
                    this.chkValues.Checked=true;
                    this.chkValues.Disabled=true;
                }
                else
                {
                    if(_report.GraphType==OlapReport.GraphTypeEnum.BarVertical)
                    {
                        series.ChangeView(ViewType.Bar);
                    }
                    else if(_report.GraphType==OlapReport.GraphTypeEnum.BarHorizontal)
                    {
                        series.ChangeView(ViewType.Bar);
                        rotateGraph=true;
                    }
                    else if(_report.GraphType==OlapReport.GraphTypeEnum.StackedBarVertical)
                        series.ChangeView(ViewType.StackedBar);
                    else if(_report.GraphType==OlapReport.GraphTypeEnum.StackedBarHorizontal)
                    {
                        series.ChangeView(ViewType.StackedBar);
                        rotateGraph=true;
                    }
                    else if(_report.GraphType==OlapReport.GraphTypeEnum.LineHorizontal)
                        series.ChangeView(ViewType.Line);

                    series.LegendText=name;
                    series.ShowInLegend=true;
                    series.ValueScaleType=ScaleType.Numerical;
                    series.Visible=true;

                    // labels orientation
                    XYDiagram diag=(XYDiagram)_chCtrl.Diagram;
                    diag.Rotated=rotateGraph;
                    if(rotateGraph)
                    {
                        diag.AxisY.Label.Antialiasing=true;
                        diag.AxisY.Label.Angle=315;
                    }
                    else
                    {
                        diag.AxisX.Label.Antialiasing=true;
                        diag.AxisX.Label.Angle=315;
                    }
//.........这里部分代码省略.........
开发者ID:GermanGlushkov,项目名称:FieldInformer,代码行数:101,代码来源:GraphControl.ascx.cs


注:本文中的Series.ChangeView方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。