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


C# Series.Sort方法代码示例

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


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

示例1: SetChart

        public static void SetChart(Dictionary<string, int> rawValues, Chart chart)
        {
            int fmin = 0;
            int fmax = 1;

            if (rawValues.Count > 0)
            {
                fmax = rawValues.Max(x => x.Value);
                fmin = rawValues.Min(x => x.Value);
            }

            //series init
            chart.Series.Clear();
            //   chart.Tag = values;
            var s = new Series();
            s.ChartType = SeriesChartType.Bar;

            foreach (var kvp in rawValues)
            {
                s.Points.AddXY(kvp.Key, kvp.Value);
                var dpc = s.Points[s.Points.Count - 1];
                dpc.Color = ColorExtras.GetRedGreenBlendedColour(kvp.Value, 0, fmax);
                dpc.ToolTip = kvp.Key + ":" + kvp.Value;
            }

            s.YAxisType = AxisType.Primary;
            s.XAxisType = AxisType.Secondary;
            s.IsVisibleInLegend = false;
            chart.Series.Add(s);
            //chartarea init
            chart.ChartAreas.Clear();
            var ca = new ChartArea();

              //  ca.CursorX.IsUserEnabled = true;
               // ca.CursorX.IsUserSelectionEnabled = true;

            ca.AxisX2.ScrollBar.IsPositionedInside = false;
            ca.AxisX2.ScaleView.Size = zoomMax;
            ca.AxisX2.ScaleView.Position=rawValues.Count-ca.AxisX2.ScaleView.Size;

            ca.AxisX2.Interval = 1;
            ca.AxisY.Interval = MathExtras.Ceiling((Math.Abs(fmax) - Math.Abs(fmin)) / 8);
            if (ca.AxisY.Interval<1)
                ca.AxisY.Interval = 1;

            ca.AxisY.Minimum = fmin;
            ca.AxisY.Maximum = fmax;
            if (Math.Abs(ca.AxisY.Minimum - ca.AxisY.Maximum) < 1)
                ca.AxisY.Minimum--;

            s.Sort(PointSortOrder.Ascending);
            chart.ChartAreas.Add(ca);
        }
开发者ID:andreigec,项目名称:Phrase-Profiler,代码行数:53,代码来源:ChartMethods.cs

示例2: createChartStation

        public Chart createChartStation( int station, String echelle, String type )
        {
            Dictionary<int, KeyValuePair<double, double>> statsTab;
              if ( type == "Arrondissement" ) {
            statsTab = this.StatistiquesArrondissement( convertStationToDistrict( station ) ,echelle);
              }
              else if ( type == "Paris" ) {
            statsTab = this.StatistiquesParis(echelle);
              }
              else {
            if ( echelle == "Heure" ) {
              statsTab = LocalDataBase.statsTabHeure[ station ];
            }
            else if ( echelle == "Jour" ) {
              statsTab = LocalDataBase.statsTabJour[ station ];
            }
            else {
            statsTab = LocalDataBase.statsTabHeureOuvre[ station ];
            }

              }

              Chart chartStat;
              ChartArea meanArea = new ChartArea();
              Series plusEcart = new Series("EcartType");

              meanArea.AxisY.Title = "Moyenne disponibilité";
              meanArea.AxisX.Title = echelle;
              meanArea.AxisX.TitleFont = new System.Drawing.Font( "Helvetica", 10, System.Drawing.FontStyle.Bold );
              meanArea.AxisY.TitleFont = new System.Drawing.Font( "Helvetica", 10, System.Drawing.FontStyle.Bold );
              meanArea.Name = "StatArea";
              meanArea.AxisX.MajorGrid.Enabled = false;
              Legend legendStat = new Legend();
              Series seriesStat = new Series( "Moyenne disponibilité " +  echelle );

              chartStat = new System.Windows.Forms.DataVisualization.Charting.Chart();
              ((System.ComponentModel.ISupportInitialize) (chartStat)).BeginInit();

              foreach(int temps in statsTab.Keys){
            seriesStat.Points.AddXY(temps,statsTab[ temps ].Key );

              }

              foreach ( int temps in statsTab.Keys ) {
            double varUp =0.95 ;

            if ( statsTab[ temps ].Key + Math.Sqrt( statsTab[ temps ].Value ) < 0.95 ) {
              varUp = statsTab[ temps ].Key +  statsTab[ temps ].Value ;
            }

            double varDw = 0.05;
            if ( statsTab[ temps ].Key - Math.Sqrt( statsTab[ temps ].Value ) > 0.05 ) {
              varDw = statsTab[ temps ].Key - statsTab[ temps ].Value ;
            }

            //double varUp = statsTab[ temps ].Key +  statsTab[ temps ].Value ;
            //double varDw = statsTab[ temps ].Key - statsTab[ temps ].Value ;
            //double[] dataD = new double[] { statsTab[ temps ].Key ,var, statsTab[ temps ].Key + Math.Sqrt(statsTab[ temps ].Value)};
            double[] dataD = new double[] { statsTab[ temps ].Key, varDw , varUp };
            DataPoint point = new DataPoint(temps,dataD);
            plusEcart.Points.Add(point);
              }

              seriesStat.Sort( PointSortOrder.Ascending, "X" );
              seriesStat.Color = System.Drawing.Color.Purple;
              plusEcart.Color = System.Drawing.Color.RoyalBlue;
              seriesStat.BorderWidth = 2;
              plusEcart.BorderWidth = 1;
              plusEcart.Sort( PointSortOrder.Ascending, "X" );
              chartStat.Series.Add( seriesStat );
              chartStat.Series.Add( plusEcart );
              chartStat.ChartAreas.Add( meanArea );
              chartStat.BackColor = System.Drawing.Color.Silver;
              meanArea.BackColor = System.Drawing.Color.LightGray;
              legendStat.Name = "legend";
              //legendStat.DockedToChartArea = "StatArea";
              legendStat.Docking = Docking.Bottom;
              Title titre;
              chartStat.Legends.Add( legendStat );

              if ( type == "Arrondissement" ) {
            titre = new Title( type + " " + convertStationToDistrict( station ));
              }
              else if ( type == "Paris" ) {
            titre = new Title( type + " ");
              }
              else {
            titre = new Title( type + " " +  station );
              }

              titre.Font = new System.Drawing.Font( "Helvetica", 10, System.Drawing.FontStyle.Bold );

              chartStat.Titles.Add( titre );
              chartStat.Size = new System.Drawing.Size( 500, 300 );
              seriesStat.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
              plusEcart.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.ErrorBar;

              ((System.ComponentModel.ISupportInitialize) (chartStat)).EndInit();

              return chartStat;
//.........这里部分代码省略.........
开发者ID:tiemnv,项目名称:ping2011ms,代码行数:101,代码来源:StatsChartsVelib.cs

示例3: createChartCentroides

        public Chart createChartCentroides( double[] centroideI,int numeroCentroide, String echelle )
        {
            Chart chartStat;
              ChartArea meanArea = new ChartArea();

              meanArea.AxisY.Title = "Moyenne disponibilité";
              meanArea.AxisX.Title = echelle;
              meanArea.AxisX.TitleFont = new System.Drawing.Font( "Helvetica", 10, System.Drawing.FontStyle.Bold );
              meanArea.AxisY.TitleFont = new System.Drawing.Font( "Helvetica", 10, System.Drawing.FontStyle.Bold );
              meanArea.Name = "StatArea";
              meanArea.AxisX.MajorGrid.Enabled = false;
              Legend legendStat = new Legend();
              Series seriesStat = new Series( "Centroïde numéro "+ numeroCentroide + " Représentation par " + echelle );

              chartStat = new System.Windows.Forms.DataVisualization.Charting.Chart();
              ((System.ComponentModel.ISupportInitialize) (chartStat)).BeginInit();

              for(int i = 0 ; i < centroideI.GetLength(0); i++) {
            seriesStat.Points.AddXY(i+1,centroideI[i]);

              }

              seriesStat.Sort( PointSortOrder.Ascending, "X" );

              seriesStat.Color = System.Drawing.Color.FromName(colors[numeroCentroide]);
              seriesStat.BorderColor = System.Drawing.Color.Black;
              seriesStat.BorderWidth = 2;
              chartStat.Series.Add( seriesStat );
              chartStat.ChartAreas.Add( meanArea );
              chartStat.BackColor = System.Drawing.Color.Silver;
              meanArea.BackColor = System.Drawing.Color.LightGray;
              legendStat.Name = "legend";
              legendStat.Docking = Docking.Bottom;
              Title titre = new Title("Caractéristiques du centroïde " + numeroCentroide);
              chartStat.Legends.Add( legendStat );

              titre.Font = new System.Drawing.Font( "Helvetica", 10, System.Drawing.FontStyle.Bold );

              chartStat.Titles.Add( titre );
              chartStat.Size = new System.Drawing.Size( 500, 300 );
              seriesStat.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;

              ((System.ComponentModel.ISupportInitialize) (chartStat)).EndInit();

              return chartStat;
        }
开发者ID:tiemnv,项目名称:ping2011ms,代码行数:46,代码来源:StatsChartsVelib.cs

示例4: createChartPOIs

        public Chart createChartPOIs( Dictionary<int,int> clusters,int nbClusters)
        {
            Chart chartStat;
              ChartArea meanArea = new ChartArea();
              double[] histoMoyenneCluster = new double[nbClusters ];
              int[] compteur = new int[nbClusters];
              for ( int i = 0 ; i < histoMoyenneCluster.Length ; i++ ) {
            histoMoyenneCluster[ i ] = 0.0;
            compteur[i] = 0;
              }

              foreach ( int station in clusters.Keys ) {
            histoMoyenneCluster[ clusters[ station ] ] += poiNumber[ station ];
            compteur[clusters[ station ]]++;
              }

              for ( int i = 0 ; i < histoMoyenneCluster.Length ; i++ ) {
            histoMoyenneCluster[ i ] = histoMoyenneCluster[ i ] / compteur[ i ];
              }

              meanArea.AxisY.Title = "Moyenne de POIS proches de chaque station du cluster";
              meanArea.AxisX.Title = "Cluster";
              meanArea.AxisX.TitleFont = new System.Drawing.Font( "Helvetica", 10, System.Drawing.FontStyle.Bold );
              meanArea.AxisY.TitleFont = new System.Drawing.Font( "Helvetica", 10, System.Drawing.FontStyle.Bold );
              meanArea.Name = "StatArea";
              meanArea.AxisX.MajorGrid.Enabled = false;
              Legend legendStat = new Legend();
              Series seriesStat = new Series();
              chartStat = new System.Windows.Forms.DataVisualization.Charting.Chart();
              ((System.ComponentModel.ISupportInitialize) (chartStat)).BeginInit();

              for ( int i = 0 ; i <histoMoyenneCluster.Length ; i++ ) {
            Series tempSer = new Series( "Centroide" + i );
            tempSer.Points.AddXY( i, histoMoyenneCluster[ i ] );
            tempSer.Color = System.Drawing.Color.FromName(colors[i] );
            tempSer.BorderColor = System.Drawing.Color.Black;
            tempSer.BorderWidth = 1;
            tempSer.Sort( PointSortOrder.Ascending, "X" );
            tempSer.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Column;
            chartStat.Series.Add( tempSer );
              }
              seriesStat.Sort( PointSortOrder.Ascending, "X" );

              seriesStat.BorderColor = System.Drawing.Color.Black;
              seriesStat.BorderWidth = 2;
              chartStat.Series.Add( seriesStat );
              chartStat.ChartAreas.Add( meanArea );
              chartStat.BackColor = System.Drawing.Color.Silver;
              meanArea.BackColor = System.Drawing.Color.LightGray;
              legendStat.Name = "legend";
              legendStat.Docking = Docking.Bottom;
              Title titre = new Title( "Caractéristiques du centroïde en terme de POIS " );
              chartStat.Legends.Add( legendStat );

              titre.Font = new System.Drawing.Font( "Helvetica", 10, System.Drawing.FontStyle.Bold );

              chartStat.Titles.Add( titre );
              chartStat.Size = new System.Drawing.Size( 500, 300 );

              ((System.ComponentModel.ISupportInitialize) (chartStat)).EndInit();

              return chartStat;
        }
开发者ID:tiemnv,项目名称:ping2011ms,代码行数:63,代码来源:StatsChartsVelib.cs

示例5: createChartAllCentroides

        public Chart createChartAllCentroides( Dictionary<int,double[]> centroides, String echelle )
        {
            Chart chartStat;
              ChartArea meanArea = new ChartArea();

              meanArea.AxisY.Title = "Moyenne disponibilité";
              meanArea.AxisX.Title = echelle;
              meanArea.AxisX.TitleFont = new System.Drawing.Font( "Helvetica", 10, System.Drawing.FontStyle.Bold );
              meanArea.AxisY.TitleFont = new System.Drawing.Font( "Helvetica", 10, System.Drawing.FontStyle.Bold );
              meanArea.Name = "StatArea";
              meanArea.AxisX.MajorGrid.Enabled = false;
              chartStat = new System.Windows.Forms.DataVisualization.Charting.Chart();
              ((System.ComponentModel.ISupportInitialize) (chartStat)).BeginInit();

              foreach ( int centroide in centroides.Keys ) {
            Series tempSer = new Series("Centroide " + centroide );
            tempSer.Color = System.Drawing.Color.FromName( colors[ centroide ] );
            tempSer.BorderColor = System.Drawing.Color.Black;
            tempSer.BorderWidth = 2;
            for ( int i = 0 ; i < centroides[centroide].GetLength( 0 ) ; i++ ) {
              tempSer.Points.AddXY( i + 1, centroides[ centroide ][ i ] );
            }
            tempSer.Sort( PointSortOrder.Ascending, "X" );
            tempSer.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
            chartStat.Series.Add( tempSer );
              }
              chartStat.ChartAreas.Add( meanArea );
              chartStat.BackColor = System.Drawing.Color.Silver;
              meanArea.BackColor = System.Drawing.Color.LightGray;
              Title titre = new Title( "Caractéristiques des centroïdes ");

              titre.Font = new System.Drawing.Font( "Helvetica", 10, System.Drawing.FontStyle.Bold );

              chartStat.Titles.Add( titre );
              chartStat.Size = new System.Drawing.Size( 500, 300 );

              ((System.ComponentModel.ISupportInitialize) (chartStat)).EndInit();

              return chartStat;
        }
开发者ID:tiemnv,项目名称:ping2011ms,代码行数:40,代码来源:StatsChartsVelib.cs


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