■ PiePlot 클래스의 SliceFillColors/SliceLabelColors 속성을 사용해 슬라이스와 레이블 색상을 설정하는 방법을 보여준다.
▶ MainForm.cs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
using System.Drawing; using System.Windows.Forms; using ScottPlot; using ScottPlot.Plottable; namespace TestProject { /// <summary> /// 메인 폼 /// </summary> public partial class MainForm : Form { //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor ////////////////////////////////////////////////////////////////////////////////////////// Public #region 생성자 - MainForm() /// <summary> /// 생성자 /// </summary> public MainForm() { InitializeComponent(); Plot plot = new Plot(800, 600); double[] valueArray = { 778, 43, 283, 76, 184 }; string[] labelArray = { "C#", "JAVA", "Python", "F#", "PHP" }; Color[] sliceColorArray = { ColorTranslator.FromHtml("#178600"), ColorTranslator.FromHtml("#B07219"), ColorTranslator.FromHtml("#3572A5"), ColorTranslator.FromHtml("#B845FC"), ColorTranslator.FromHtml("#4F5D95") }; Color[] labelColorArray = { Color.FromArgb(255, Color.White), Color.FromArgb(100, Color.White), Color.FromArgb(250, Color.White), Color.FromArgb(150, Color.White), Color.FromArgb(200, Color.White) }; PiePlot piePlot = plot.AddPie(valueArray); piePlot.SliceFillColors = sliceColorArray; piePlot.ShowLabels = true; piePlot.SliceLabelColors = labelColorArray; piePlot.SliceLabels = labelArray; this.formsPlot.Reset(plot); this.formsPlot.Refresh(); } #endregion } } |