예제 #1
0
        private VfChartSeries BuildSeriesArray(string sSeriesName, string sAggregType)
        {
            DataRow[] drArr = ChartDataTable.Select("SeriesName = '" + sSeriesName + "'");
            var       srs   = new VfChartSeries(sSeriesName);

            if (drArr != null)
            {
                for (int x = 0; x < (drArr[0].ItemArray.Length - 1); x++)
                {
                    if (sAggregType.ToUpper() == "AVG")
                    {
                        if (String.IsNullOrEmpty(drArr[0][x + 1].ToString().Trim()))
                        {
                            srs.AddItem(ChartDataTable.Columns[x + 1].ColumnName, 0, 0);
                        }
                        else
                        {
                            string[] sValArr  = drArr[0][x + 1].ToString().Split(',');
                            int      iNumVals = sValArr.Length;
                            var      fTot     = 0D;
                            foreach (string sVal in sValArr)
                            {
                                fTot = fTot + double.Parse(sVal, providerEn);
                            }

                            srs.AddItem(ChartDataTable.Columns[x + 1].ColumnName, fTot / iNumVals, 0);
                        }
                    }
                    else
                    {
                        if (String.IsNullOrEmpty(drArr[0][x + 1].ToString().Trim()))
                        {
                            srs.AddItem(ChartDataTable.Columns[x + 1].ColumnName, 0, 0);
                        }
                        else
                        {
                            srs.AddItem(ChartDataTable.Columns[x + 1].ColumnName, Convert.ToDouble(drArr[0][x + 1]), 0);
                        }
                    }
                }
            }

            return(srs);
        }
예제 #2
0
 private static void SortChart(VfChartSeries vfChartSeries)
 {
     vfChartSeries.Sort((a, b) => a.XAxisLabel.CompareTo(b.XAxisLabel));
 }