/// <summary> /// 设置曲线类型 /// </summary> /// <param name="chart">dotNetChart</param> /// <param name="chartType">dotNetChart类型</param> /// <param name="seriesType">dotNetChart曲线类型</param> private void setChartType(dotnetCHARTING.Chart chart, dotnetCHARTING.ChartType chartType, dotnetCHARTING.SeriesType seriesType) { chart.Type = chartType; for (int i = 0; i < chart.SeriesCollection.Count; i++) { chart.SeriesCollection[i].Type = seriesType; chart.SeriesCollection[i].Name = this._lstName[i]; } }
/// <summary> /// ChartDisplay: Method used to display chart /// </summary> /// <param name="strChart">string Chart type </param> /// <param name="strName">string Chart Color palette</param> private void ChartDisplay(string strChart, string strName) { ArrayList myArrayList = new ArrayList(); myArrayList.Add(new Product("P1", 44)); myArrayList.Add(new Product("P2", 12)); myArrayList.Add(new Product("P3", 20)); myArrayList.Add(new Product("P4", 65)); myArrayList.Add(new Product("P5", 50)); myArrayList.Add(new Product("P6", 40)); dotnetCHARTING.ChartType myChartType = (dotnetCHARTING.ChartType)Enum.Parse(typeof(dotnetCHARTING.ChartType), strChart, true); dotnetCHARTING.Scale myAxisScale = (dotnetCHARTING.Scale)Enum.Parse(typeof(dotnetCHARTING.Scale), "Normal", true); dotnetCHARTING.SeriesType mySeriesType = (dotnetCHARTING.SeriesType)Enum.Parse(typeof(dotnetCHARTING.SeriesType), "Column", true); dotnetCHARTING.PieLabelMode myPieLabelMode = dotnetCHARTING.PieLabelMode.Outside; dotnetCHARTING.LegendBoxPosition myLegendBoxPosition = dotnetCHARTING.LegendBoxPosition.None; //General settings chartModule.DefaultSeries.LimitMode = (dotnetCHARTING.LimitMode)Enum.Parse(typeof(dotnetCHARTING.LimitMode), "Top", true); chartModule.DefaultSeries.DefaultElement.ShowValue = true; chartModule.DefaultAxis.NumberPercision = 0; chartModule.Mentor = false; chartModule.TempDirectory = "temp"; chartModule.Visible = true; chartModule.Type = myChartType; chartModule.Height = 200; chartModule.Width = 300; chartModule.UseFile = true; chartModule.Debug = false; chartModule.DonutHoleSize = 50; chartModule.LegendBox.Template = "%icon%name"; chartModule.LegendBox.Position = myLegendBoxPosition; chartModule.Use3D = true; chartModule.Transpose = true; chartModule.DefaultSeries.ShowOther = true; chartModule.DefaultSeries.Type = mySeriesType; chartModule.DefaultAxis.Scale = myAxisScale; chartModule.PieLabelMode = myPieLabelMode; chartModule.Series.Name = ""; chartModule.AutoNameLabels = true; chartModule.Title = ""; chartModule.Series.Data = myArrayList; chartModule.Series.DataFields = "xAxis=Name,yAxis=Total"; chartModule.SeriesCollection.Add(); chartModule.DefaultSeries.DefaultElement.Transparency = 10; chartModule.PaletteName = customerActivitySheet.GetPaletteName(strName); chartModule.DefaultSeries.DefaultElement.ShowValue = true; }