// ================================================= SetBarChart private void SetBarChart () { fVals = new double [nSet, nSegment]; for (int i = 0; i < nSet; i++) { for (int j = 0; j < nSegment; j++) { fVals [i, j] = rand .Next (nSeed) % 1000; } } if (bAfterInit) { texts = PrepareTexts (); } else { texts = Auxi_Common .strDays; } chart = new BarChart (this, rc, fVals, Side .S, texts, TextsDrawingDirection .LTtoRB, //Auxi_Common .strDays Side .E, 1000.0, 0.0, GridOrigin .ByStep, 200.0); chart .Colors = Auxi_Colours .SmoothColorsList (nSet, clrStart, clrEnd); chart .FillCoefficients (0, 0.85); chart .NumScale .Visible = false; chart .TextScale .Visible = false; }
// ------------------------------------------------- Click_btnAddChart private void Click_btnAddChart (object sender, EventArgs e) { int nSegment = Convert .ToInt32 (numericUD_Segments .Value); int nSet = Convert .ToInt32 (numericUD_Sets .Value); double [,] fVal = new double [nSet, nSegment]; for (int i = 0; i < nSet; i++) { for (int j = 0; j < nSegment; j++) { fVal [i, j] = rand .Next (nSeed) % 1000; } } Rectangle rc = new Rectangle (ClientSize .Width / 3, ClientSize .Height / 3, ClientSize .Width / 3, ClientSize .Height / 3); BarChart bc = new BarChart (this, rc, fVal, Side .S, Auxi_Common .strMonths, TextsDrawingDirection .LTtoRB, Side .E, 1000.0, 0.0, GridOrigin .ByStep, 200.0); bc .Colors = clrs; bc .FillCoefficients (0, 0.85); bc .NumScale .ValuesFormat = "F0"; bc .AddComment (0.8, 0.1, "BarChart_" + barcharts .Count .ToString (), new Font ("Times New Roman", 11, FontStyle .Bold), 0, Color .Red); barcharts .Insert (0, bc); RenewMover (); Invalidate (); }
// ------------------------------------------------- DefaultView private void DefaultView () { numericUD_Sets .Location = new Point (50, 410); //, 46, 22); GroupNewChart_RelativePosition (); ClientSize = new Size (info .Area .Right + 12, btnAddChart .Bottom + 20); // (780, 610); // barchart_A // int nSegment = Auxi_Common .strDays .Length; int nSet = 4; double [,] fRandVal = new double [nSet, nSegment]; for (int i = 0; i < nSet; i++) { for (int j = 0; j < nSegment; j++) { fRandVal [i, j] = rand .Next (nSeed) % 100; } } Rectangle rc = new Rectangle (90, 40, 260, 280); BarChart barchart_A = new BarChart (this, rc, fRandVal, Side .W, Auxi_Common .strDays, TextsDrawingDirection .LTtoRB, Side .S, 0.0, 100.0, GridOrigin .ByStep, 25.0); barchart_A .FillCoefficients (0.1, 0.8); barchart_A .NumScale .ValuesFormat = "F0"; barchart_A .AddComment (0.7, 0.15, "BarChart_A", new Font ("Times New Roman", 12, FontStyle .Bold | FontStyle .Italic), 0, Color .Blue); // barchart_B // nSegment = Auxi_Common .strDays .Length - 3; nSet = 6; fRandVal = new double [nSet, nSegment]; for (int i = 0; i < nSet; i++) { for (int j = 0; j < nSegment; j++) { fRandVal [i, j] = rand .Next (nSeed) % 100; } } rc = new Rectangle (260, 180, 460, 385); BarChart barchart_B = new BarChart (this, rc, fRandVal, Side .S, Auxi_Common .strDays, TextsDrawingDirection .LTtoRB, Side .E, 100.0, 0.0, GridOrigin .ByStep, 20.0); barchart_B .FillCoefficients (0, 0.85); barchart_B .NumScale .ValuesFormat = "F0"; barchart_B .AddComment (0.5, 0.1, "BarChart_B", new Font ("Times New Roman", 11, FontStyle .Bold), 0, Color .Red); barcharts .Insert (0, barchart_A); barcharts .Insert (0, barchart_B); }
// ------------------------------------------------- DefaultView private void DefaultView () { ClientSize = new Size (811, 690); Font fntTitle = new Font ("Times New Roman", 12, FontStyle .Bold | FontStyle .Italic); Font fntSectors = new Font ("Times New Roman", 12); double angleTitle = 0; Color clrTitle = Color .Blue; RingSet rs = new RingSet (this, new Point (ClientRectangle .Width / 4, ClientRectangle .Height / 4), 30, 80, new double [] { 1, 2, 4, 8, 16 }); rs .Rings [0] .SectorTexts = Auxi_Common .strDays; int newInner = rs .OuterMostRadius; rs .AddRing (newInner, newInner + 50, Math .PI / 3, new double [] { 3, 7, 2, 9, 4 }); newInner = rs .OuterMostRadius; double [] fVal = new double [] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; RingArea ring = new RingArea (this, new Point (0, 0), newInner, newInner + 75, fVal); ring .Colors = Auxi_Colours .SmoothColorsList (fVal .Length, Color .Yellow, Color .Blue); ring .SectorTexts = Auxi_Common .strMonths; rs .AddRing (ring); elems .Add (new SingleElem (rs)); double [] fRandVal = Auxi_Common .RandomArray (1000, Auxi_Common .strDays .Length); PieChart chart = new PieChart (this, new Point (ClientRectangle .Width / 5, ClientRectangle .Height * 2 / 3), Math .Max (ClientRectangle .Width, ClientRectangle .Height) / 4, fRandVal); chart .SectorTexts = Auxi_Common .strDays; for (int i = 0; i < chart .Colors .Count; i++) { chart .ChangeColor (i, Auxi_Colours .ColorPredefined (i)); } int nDifViews = Enum .GetNames (typeof (RoundPlotTextView)) .Length; for (int i = 0; i < chart .Sectors; i++) { chart .SectorComments [i] .TextView = (RoundPlotTextView) (Enum .GetValues (typeof (RoundPlotTextView)) .GetValue (i % nDifViews)); chart .SectorComments [i] .Font = fntSectors; } chart .AddComment (-90, 0.2, DateTime .Now .ToShortTimeString (), fntTitle, angleTitle, clrTitle); elems .Insert (0, new SingleElem (chart)); int nSector = 21; fRandVal = Auxi_Common .RandomArray (1000, nSector); rs = new RingSet (this, new Point (ClientRectangle .Width * 3 / 4, ClientRectangle .Height / 3), 40, Convert .ToInt32 (chart .Radius * 1.1), fRandVal); rs .Rings [0] .Colors = Auxi_Colours .SmoothColorsList (nSector, Color .White, Color .LightBlue); rs .AddComment (90, 0.3, "People", fntTitle, angleTitle, clrTitle); for (int i = 0; i < rs .Rings [0] .Sectors; i++) { rs .Rings [0] .Comments [i] .Text = Auxi_Common .StringOfText (Auxi_Common .strNames, i); rs .Rings [0] .Comments [i] .TextView = RoundPlotTextView .Text; rs .Rings [0] .Comments [i] .Angle = rs .Rings [0] .Comments [i] .AngleToCenter; rs .Rings [0] .Comments [i] .Font = fntSectors; } rs .Rings [0] .FixedSectorTextsAngles = false; rs .Rings [0] .EasyToReadOnRotation = true; elems .Insert (0, new SingleElem (rs)); // barchart // int nSegment = Auxi_Common .strDays .Length - 2; int nSet = 4; double [,] fVals = new double [nSet, nSegment]; for (int i = 0; i < nSet; i++) { for (int j = 0; j < nSegment; j++) { fVals [i, j] = rand .Next (nSeed) % 1000; } } Rectangle rc = new Rectangle (ClientRectangle .Width / 2, ClientRectangle .Height / 2, ClientRectangle .Width * 3 / 7, ClientRectangle .Height * 2 / 5); BarChart barchart = new BarChart (this, rc, fVals, Side .S, Auxi_Common .strDays, TextsDrawingDirection .LTtoRB, Side .E, 1000.0, 0.0, GridOrigin .ByStep, 200.0); barchart .FillCoefficients (0, 0.85); barchart .NumScale .ValuesFormat = "F0"; barchart .AddComment (0.5, 0.1, "Default BarChart", new Font ("Times New Roman", 11, FontStyle .Bold), 0, Color .Red); elems .Insert (0, new SingleElem (barchart)); }