private void InitializeComponent2() { this.components = new System.ComponentModel.Container(); this.m_panelChartLegend = new Nolme.WinForms.ChartLegend(this.components); this.m_chartSample1 = new Nolme.WinForms.Chart(this.components); this.m_chartSample2 = new Nolme.WinForms.Chart(this.components); this.m_chartSample3 = new Nolme.WinForms.Chart(this.components); this.SuspendLayout(); // // m_panelChartLegend // this.m_panelChartLegend.BackColor = System.Drawing.SystemColors.Info; this.m_panelChartLegend.ChartLegendDescription.BottomMargin = 20; this.m_panelChartLegend.Curvature = 15; this.m_panelChartLegend.GradientMode = System.Drawing.Drawing2D.LinearGradientMode.ForwardDiagonal; this.m_panelChartLegend.ChartLegendDescription.ItemBottomMargin = 30; this.m_panelChartLegend.ChartLegendDescription.ItemFont = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular | FontStyle.Bold); this.m_panelChartLegend.ChartLegendDescription.ItemLeftMargin = 5; this.m_panelChartLegend.ChartLegendDescription.ItemRightMargin = 10; this.m_panelChartLegend.ChartLegendDescription.ItemSize = 10; this.m_panelChartLegend.ChartLegendDescription.ItemTopMargin = 20; this.m_panelChartLegend.ChartLegendDescription.LeftMargin = 20; this.m_panelChartLegend.Location = new System.Drawing.Point(8, 8); this.m_panelChartLegend.ChartLegendDescription.MainTitle = "ÃÒ¡ÒáÅéͧ·Õèʹã¨"; this.m_panelChartLegend.ChartLegendDescription.MainTitleFont = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular | FontStyle.Bold); this.m_panelChartLegend.Name = "m_panelChartLegend"; this.m_panelChartLegend.ChartLegendDescription.RightMargin = 20; this.m_panelChartLegend.Size = new System.Drawing.Size(176, 304); this.m_panelChartLegend.TabIndex = 5; this.m_panelChartLegend.ChartLegendDescription.TopMargin = 20; // // m_chartSample1 // this.m_chartSample1.BackColor = System.Drawing.Color.Silver; this.m_chartSample1.ChartDescription.BottomMargin = 80; this.m_chartSample1.ChartDescription.ColumnFont = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular | FontStyle.Bold); this.m_chartSample1.ChartDescription.ColumnTitleFont = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular | FontStyle.Bold); this.m_chartSample1.Curvature = 15; this.m_chartSample1.ChartDescription.DeltaDepth = 10; this.m_chartSample1.ChartDescription.DisplayHiddenSides = true; this.m_chartSample1.ChartDescription.DisplayTextOnColumns = true; this.m_chartSample1.GradientMode = System.Drawing.Drawing2D.LinearGradientMode.ForwardDiagonal; this.m_chartSample1.ChartDescription.LeftMargin = 50; this.m_chartSample1.ChartDescription.LegendFont = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular | FontStyle.Bold); this.m_chartSample1.Location = new System.Drawing.Point(8, 8); this.m_chartSample1.ChartDescription.MainTitle = "áÊ´§¡ÃÒ¿à˵ءÒóì"; this.m_chartSample1.ChartDescription.MainTitleFont = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular | FontStyle.Bold); this.m_chartSample1.ChartDescription.MarginBetweenColumn = 20; this.m_chartSample1.Name = "m_chartSample1"; this.m_chartSample1.ChartDescription.RenderingMode = Nolme.WinForms.ChartRenderingMode.Linear3d; this.m_chartSample1.ChartDescription.RightMargin = 20; this.m_chartSample1.Size = new System.Drawing.Size(456, 304); this.m_chartSample1.TabIndex = 4; this.m_chartSample1.ChartDescription.TopMargin = 20; this.m_chartSample1.ChartDescription.VerticalAxisMaxValue = 10000; this.m_chartSample1.ChartDescription.VerticalAxisMinValue = 0; this.m_chartSample1.ChartDescription.VerticalAxisStep = 1000; this.m_chartSample1.Dock = System.Windows.Forms.DockStyle.Fill; this.m_panelChartLegend.Dock = System.Windows.Forms.DockStyle.Fill; this.panel1.Controls.Add(this.m_chartSample1); this.panel3.Controls.Add(this.m_panelChartLegend); this.ResumeLayout(false); }
private void InitializeComponent2() { this.components = new System.ComponentModel.Container(); this.m_panelChartLegend = new Nolme.WinForms.ChartLegend(this.components); this.m_chartSample1 = new Nolme.WinForms.Chart(this.components); this.m_chartSample2 = new Nolme.WinForms.Chart(this.components); this.m_chartSample3 = new Nolme.WinForms.Chart(this.components); this.SuspendLayout(); // // m_panelChartLegend // this.m_panelChartLegend.BackColor = System.Drawing.SystemColors.Info; this.m_panelChartLegend.ChartLegendDescription.BottomMargin = 20; this.m_panelChartLegend.Curvature = 15; this.m_panelChartLegend.GradientMode = System.Drawing.Drawing2D.LinearGradientMode.ForwardDiagonal; this.m_panelChartLegend.ChartLegendDescription.ItemBottomMargin = 30; this.m_panelChartLegend.ChartLegendDescription.ItemFont = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Italic); this.m_panelChartLegend.ChartLegendDescription.ItemLeftMargin = 5; this.m_panelChartLegend.ChartLegendDescription.ItemRightMargin = 10; this.m_panelChartLegend.ChartLegendDescription.ItemSize = 10; this.m_panelChartLegend.ChartLegendDescription.ItemTopMargin = 20; this.m_panelChartLegend.ChartLegendDescription.LeftMargin = 20; this.m_panelChartLegend.Location = new System.Drawing.Point(476, 8); this.m_panelChartLegend.ChartLegendDescription.MainTitle = "Main title"; this.m_panelChartLegend.ChartLegendDescription.MainTitleFont = new System.Drawing.Font("Arial", 16F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Underline)))); this.m_panelChartLegend.Name = "m_panelChartLegend"; this.m_panelChartLegend.ChartLegendDescription.RightMargin = 20; this.m_panelChartLegend.Size = new System.Drawing.Size(176, 304); this.m_panelChartLegend.TabIndex = 5; this.m_panelChartLegend.ChartLegendDescription.TopMargin = 20; // // m_chartSample1 // this.m_chartSample1.BackColor = System.Drawing.Color.Silver; this.m_chartSample1.ChartDescription.BottomMargin = 20; this.m_chartSample1.ChartDescription.ColumnFont = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Italic); this.m_chartSample1.ChartDescription.ColumnTitleFont = new System.Drawing.Font("Arial", 10F, System.Drawing.FontStyle.Underline); this.m_chartSample1.Curvature = 15; this.m_chartSample1.ChartDescription.DeltaDepth = 10; this.m_chartSample1.ChartDescription.DisplayHiddenSides = true; this.m_chartSample1.ChartDescription.DisplayTextOnColumns = true; this.m_chartSample1.GradientMode = System.Drawing.Drawing2D.LinearGradientMode.ForwardDiagonal; this.m_chartSample1.ChartDescription.LeftMargin = 50; this.m_chartSample1.ChartDescription.LegendFont = new System.Drawing.Font("Arial", 11F, System.Drawing.FontStyle.Bold); this.m_chartSample1.Location = new System.Drawing.Point(8, 8); this.m_chartSample1.ChartDescription.MainTitle = "Main title"; this.m_chartSample1.ChartDescription.MainTitleFont = new System.Drawing.Font("Arial", 16F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Underline)))); this.m_chartSample1.ChartDescription.MarginBetweenColumn = 20; this.m_chartSample1.Name = "m_chartSample1"; this.m_chartSample1.ChartDescription.RenderingMode = Nolme.WinForms.ChartRenderingMode.Linear3d; this.m_chartSample1.ChartDescription.RightMargin = 20; this.m_chartSample1.Size = new System.Drawing.Size(456, 304); this.m_chartSample1.TabIndex = 4; this.m_chartSample1.ChartDescription.TopMargin = 20; this.m_chartSample1.ChartDescription.VerticalAxisMaxValue = 10000; this.m_chartSample1.ChartDescription.VerticalAxisMinValue = 0; this.m_chartSample1.ChartDescription.VerticalAxisStep = 1000; // // m_chartSample2 // this.m_chartSample2.BackColor = System.Drawing.Color.Silver; this.m_chartSample2.ChartDescription.BottomMargin = 20; this.m_chartSample2.ChartDescription.ColumnFont = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Italic); this.m_chartSample2.ChartDescription.ColumnTitleFont = new System.Drawing.Font("Arial", 10F, System.Drawing.FontStyle.Underline); this.m_chartSample2.Curvature = 15; this.m_chartSample2.ChartDescription.DeltaDepth = 10; this.m_chartSample2.ChartDescription.DisplayHiddenSides = true; this.m_chartSample2.ChartDescription.DisplayTextOnColumns = true; this.m_chartSample2.GradientMode = System.Drawing.Drawing2D.LinearGradientMode.ForwardDiagonal; this.m_chartSample2.ChartDescription.LeftMargin = 50; this.m_chartSample2.ChartDescription.LegendFont = new System.Drawing.Font("Arial", 11F, System.Drawing.FontStyle.Bold); this.m_chartSample2.Location = new System.Drawing.Point(8, 320); this.m_chartSample2.ChartDescription.MainTitle = "Main title"; this.m_chartSample2.ChartDescription.MainTitleFont = new System.Drawing.Font("Arial", 16F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Underline)))); this.m_chartSample2.ChartDescription.MarginBetweenColumn = 20; this.m_chartSample2.Name = "m_chartSample2"; this.m_chartSample2.ChartDescription.RenderingMode = Nolme.WinForms.ChartRenderingMode.Linear3d; this.m_chartSample2.ChartDescription.RightMargin = 20; this.m_chartSample2.Size = new System.Drawing.Size(456, 232); this.m_chartSample2.TabIndex = 10; this.m_chartSample2.ChartDescription.TopMargin = 20; this.m_chartSample2.ChartDescription.VerticalAxisMaxValue = 10000; this.m_chartSample2.ChartDescription.VerticalAxisMinValue = 0; this.m_chartSample2.ChartDescription.VerticalAxisStep = 1000; // // m_chartSample3 // this.m_chartSample3.BackColor = System.Drawing.Color.Silver; this.m_chartSample3.ChartDescription.BottomMargin = 40; this.m_chartSample3.ChartDescription.ColumnFont = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Italic); this.m_chartSample3.ChartDescription.ColumnTitleFont = new System.Drawing.Font("Arial", 10F, System.Drawing.FontStyle.Underline); this.m_chartSample3.Curvature = 15; this.m_chartSample3.ChartDescription.DeltaDepth = 10; this.m_chartSample3.ChartDescription.DisplayHiddenSides = true; this.m_chartSample3.ChartDescription.DisplayTextOnColumns = true; this.m_chartSample3.GradientMode = System.Drawing.Drawing2D.LinearGradientMode.ForwardDiagonal; this.m_chartSample3.ChartDescription.LeftMargin = 50; this.m_chartSample3.ChartDescription.LegendFont = new System.Drawing.Font("Arial", 11F, System.Drawing.FontStyle.Bold); this.m_chartSample3.Location = new System.Drawing.Point(470, 320); this.m_chartSample3.ChartDescription.MainTitle = "Real time"; this.m_chartSample3.ChartDescription.MainTitleFont = new System.Drawing.Font("Arial", 16F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Underline)))); this.m_chartSample3.ChartDescription.MarginBetweenColumn = 10; this.m_chartSample3.Name = "m_chartSample3"; this.m_chartSample3.ChartDescription.RenderingMode = Nolme.WinForms.ChartRenderingMode.Linear3d; this.m_chartSample3.ChartDescription.RightMargin = 20; this.m_chartSample3.Size = new System.Drawing.Size(300, 232); this.m_chartSample3.TabIndex = 10; this.m_chartSample3.ChartDescription.TopMargin = 20; this.m_chartSample3.ChartDescription.VerticalAxisMaxValue = 100; this.m_chartSample3.ChartDescription.VerticalAxisMinValue = 0; this.m_chartSample3.ChartDescription.VerticalAxisStep = 10; this.Controls.Add(this.m_panelChartLegend); this.Controls.Add(this.m_chartSample1); this.Controls.Add(this.m_chartSample2); this.Controls.Add(this.m_chartSample3); this.ResumeLayout(false); }
/// <summary> /// Draw some text on top of the chart column /// </summary> /// <param name="pevent"></param> /// <param name="parent"></param> /// <param name="backgroundRectangle"></param> virtual internal void DisplayText (System.Windows.Forms.PaintEventArgs pevent, Chart parent, RectangleF backgroundRectangle) { // Draw legend background LinearGradientBrush backgroundBrush = new LinearGradientBrush (backgroundRectangle, Color.White, Color.Gray, 45.0f, true); pevent.Graphics.FillRectangle (backgroundBrush, backgroundRectangle); pevent.Graphics.DrawRectangle (parent.ChartDescription.ColumnPen, backgroundRectangle.X, backgroundRectangle.Y, backgroundRectangle.Width, backgroundRectangle.Height); // Draw legend int TotalValues = this.PositiveValuesSum - this.NegativeValuesSum; pevent.Graphics.DrawString (TotalValues.ToString (CultureInfo.InvariantCulture), parent.ChartDescription.ColumnFont, parent.ChartDescription.LegendBrush, backgroundRectangle); }
/// <summary> /// Display title of column on bottom of grid /// </summary> /// <param name="pevent"></param> /// <param name="parent"></param> /// <param name="base0"></param> /// <param name="base1"></param> virtual internal void DisplayTitle (System.Windows.Forms.PaintEventArgs pevent, Chart parent, Point base0, Point base1) { if (this.Title != null) { StringFormat legendDrawFormat = new StringFormat(); legendDrawFormat.Alignment = StringAlignment.Far; legendDrawFormat.LineAlignment = StringAlignment.Center; // Draw oblique Matrix oldMatrix = pevent.Graphics.Transform.Clone(); pevent.Graphics.TranslateTransform( base0.X + (base1.X-base0.X)/2, base0.Y + 5); // Add few pixels pevent.Graphics.RotateTransform(-45); pevent.Graphics.DrawString(this.Title, parent.ChartDescription.ColumnTitleFont, parent.ChartDescription.LegendBrush, 0, 0, legendDrawFormat); pevent.Graphics.Transform = oldMatrix; } }
virtual internal void DisplayBorders (System.Windows.Forms.PaintEventArgs pevent, Chart parent, int currentValue, Point base0, Point base1, Point base2, Point base3, Point top0, Point top1, Point top2, Point top3) { if (parent.ChartDescription.DisplayHiddenSides) { if (currentValue >= 0) { pevent.Graphics.DrawLine (parent.ChartDescription.HiddenColumnPen, base0, base3); pevent.Graphics.DrawLine (parent.ChartDescription.HiddenColumnPen, base3, top3); pevent.Graphics.DrawLine (parent.ChartDescription.HiddenColumnPen, base3, base2); } else { pevent.Graphics.DrawLine (parent.ChartDescription.HiddenColumnPen, top0, top3); pevent.Graphics.DrawLine (parent.ChartDescription.HiddenColumnPen, base3, top3); pevent.Graphics.DrawLine (parent.ChartDescription.HiddenColumnPen, top3, top2); } } // Top /*GraphicsPath pathTop = new GraphicsPath (); pathTop.AddLine (top0, top1); pathTop.AddLine (top1, top2); pathTop.AddLine (top2, top3); pathTop.AddLine (top3, top0); pevent.Graphics.DrawPath (parent.ColumnPen, pathTop); */ // Left /*GraphicsPath pathSubValueLeft = new GraphicsPath (); pathSubValueLeft.AddLine (currentBase0, currentBase3); pathSubValueLeft.AddLine (currentBase3, currentTop3); pathSubValueLeft.AddLine (currentTop3, currentTop0); pathSubValueLeft.AddLine (currentTop0, currentBase0); pevent.Graphics.FillPath (CurrentBrushDarken, pathSubValueLeft);*/ // Back /*GraphicsPath pathSubValueBack = new GraphicsPath (); pathSubValueBack.AddLine (currentBase3, currentBase2); pathSubValueBack.AddLine (currentBase2, currentTop2); pathSubValueBack.AddLine (currentTop2, currentTop3); pathSubValueBack.AddLine (currentTop3, currentBase3); pevent.Graphics.FillPath (CurrentBrushDarken, pathSubValueBack);*/ // Front GraphicsPath pathSubValueFront = new GraphicsPath (); pathSubValueFront.AddLine (base0, base1); pathSubValueFront.AddLine (base1, top1); pathSubValueFront.AddLine (top1, top0); pathSubValueFront.AddLine (top0, base0); pevent.Graphics.DrawPath (parent.ChartDescription.ColumnPen, pathSubValueFront); // Right GraphicsPath pathSubValueRightSide = new GraphicsPath (); pathSubValueRightSide.AddLine (base1, base2); pathSubValueRightSide.AddLine (base2, top2); pathSubValueRightSide.AddLine (top2, top1); pathSubValueRightSide.AddLine (top1, base1); pevent.Graphics.DrawPath (parent.ChartDescription.ColumnPen, pathSubValueRightSide); }
virtual internal void DisplayAsBarWith3d (System.Windows.Forms.PaintEventArgs pevent, Chart parent, ChartColumn previousColumn, int columnWidthNoMargin, int verticalAxisMaxValueInPixels, Point base0, Point base1, Point base2, Point base3, Point prevBase0, Point prevBase1, Point prevBase2, Point prevBase3, bool gradientMode) { bool FirstNegativeBarToDraw = true; // Draw all values Point CurrentBase0 = base0; Point CurrentBase1 = base1; Point CurrentBase2 = base2; Point CurrentBase3 = base3; Point CurrentBasePositive0 = base0; Point CurrentBasePositive1 = base1; Point CurrentBasePositive2 = base2; Point CurrentBasePositive3 = base3; Point CurrentBaseNegative0 = base0; Point CurrentBaseNegative1 = base1; Point CurrentBaseNegative2 = base2; Point CurrentBaseNegative3 = base3; for (int i = 0; i < this.m_Values.Length; i++) { // Check if current value is the top level (all next values are 0) // This boolean is used to known when we must draw the top of bar bool AllNextValuesAreZero = true; for (int j = i+1; j < this.m_Values.Length; j++) { if (this.m_Values[j] != 0) { AllNextValuesAreZero = false; break; } } // int offset = this.m_Values[i] * (verticalAxisMaxValueInPixels) / (parent.ChartDescription.VerticalAxisMaxValue - parent.ChartDescription.VerticalAxisMinValue); if (this.m_Values[i] != 0) { if (this.m_Values[i] >= 0) { CurrentBase0 = CurrentBasePositive0; CurrentBase1 = CurrentBasePositive1; CurrentBase2 = CurrentBasePositive2; CurrentBase3 = CurrentBasePositive3; } else { CurrentBase0 = CurrentBaseNegative0; CurrentBase1 = CurrentBaseNegative1; CurrentBase2 = CurrentBaseNegative2; CurrentBase3 = CurrentBaseNegative3; } Point CurrentTop0 = new Point (CurrentBase0.X, CurrentBase0.Y - offset); Point CurrentTop1 = new Point (CurrentBase1.X, CurrentBase1.Y - offset); Point CurrentTop2 = new Point (CurrentBase2.X, CurrentBase2.Y - offset); Point CurrentTop3 = new Point (CurrentBase3.X, CurrentBase3.Y - offset); Color CurrentColor = parent.ChartDescription.GetPredefinedColor (i); // // 3D Gradient & 3D Flat // if ((parent.ChartDescription.RenderingMode == ChartRenderingMode.BarWith3dGradient) ||(parent.ChartDescription.RenderingMode == ChartRenderingMode.BarWith3d)) { // Solid brush or gradient brush Color CurrentColor2; if (parent.ChartDescription.RenderingMode == ChartRenderingMode.BarWith3dGradient) CurrentColor2 = Color.FromArgb (CurrentColor.A, CurrentColor.R /2, CurrentColor.G /2, CurrentColor.B /2); else CurrentColor2 = CurrentColor; // Compute boundaries to fill GraphicsPath pathSubValues = new GraphicsPath (); LinearGradientBrush CurrentBrush; if (this.m_Values[i] >= 0) { Point TopLeft = new Point (CurrentBase2.X, CurrentBase1.Y); Point BottomRight = new Point (CurrentTop0.X, CurrentTop3.Y); CurrentBrush = new LinearGradientBrush (TopLeft, BottomRight, CurrentColor, CurrentColor2); pathSubValues.AddLine (CurrentBase0, CurrentBase1); pathSubValues.AddLine (CurrentBase1, CurrentBase2); pathSubValues.AddLine (CurrentBase2, CurrentTop2); if (AllNextValuesAreZero) { // Add the 'Top' part' pathSubValues.AddLine (CurrentTop2, CurrentTop3); pathSubValues.AddLine (CurrentTop3, CurrentTop0); pathSubValues.AddLine (CurrentTop0, CurrentBase0); } else { // Skip the 'Top' part pathSubValues.AddLine (CurrentTop2, CurrentTop1); pathSubValues.AddLine (CurrentTop1, CurrentTop0); pathSubValues.AddLine (CurrentTop0, CurrentBase0); } } else { Point TopLeft = new Point (CurrentBase0.X, CurrentBase3.Y); Point BottomRight = new Point (CurrentTop2.X, CurrentTop1.Y); CurrentBrush = new LinearGradientBrush (TopLeft, BottomRight, CurrentColor, CurrentColor2); pathSubValues.AddLine (CurrentTop0, CurrentTop1); pathSubValues.AddLine (CurrentTop1, CurrentTop2); pathSubValues.AddLine (CurrentTop2, CurrentBase2); if (( FirstNegativeBarToDraw) && (this.PositiveValuesSum == 0)) { // Add the 'Top' part' pathSubValues.AddLine (CurrentBase2, CurrentBase3); pathSubValues.AddLine (CurrentBase3, CurrentBase0); pathSubValues.AddLine (CurrentBase0, CurrentTop0); FirstNegativeBarToDraw = false; } else { // Skip the 'Top' part pathSubValues.AddLine (CurrentBase2, CurrentBase1); pathSubValues.AddLine (CurrentBase1, CurrentBase0); pathSubValues.AddLine (CurrentBase0, CurrentTop0); } } // Fill path pevent.Graphics.FillPath (CurrentBrush, pathSubValues); // Draw borders on path this.DisplayBorders (pevent, parent, this.m_Values[i], CurrentBase0, CurrentBase1, CurrentBase2, CurrentBase3, CurrentTop0, CurrentTop1, CurrentTop2, CurrentTop3); } else { Debug.Assert (parent.ChartDescription.RenderingMode == ChartRenderingMode.Linear3d, "ChartColumn.DisplayBars", "Rendering mode not yet managed"); } // Next if (parent.ChartDescription.CumulativeMode == ChartCumulativeMode.StartFromLastValue) { if (this.m_Values[i] >= 0) { CurrentBasePositive0 = CurrentTop0; CurrentBasePositive1 = CurrentTop1; CurrentBasePositive2 = CurrentTop2; CurrentBasePositive3 = CurrentTop3; } else { CurrentBaseNegative0 = CurrentTop0; CurrentBaseNegative1 = CurrentTop1; CurrentBaseNegative2 = CurrentTop2; CurrentBaseNegative3 = CurrentTop3; } } } } // Redraw top to override hidden pen color GraphicsPath pathTop = new GraphicsPath (); pathTop.AddLine (CurrentBasePositive0, CurrentBasePositive1); pathTop.AddLine (CurrentBasePositive1, CurrentBasePositive2); pathTop.AddLine (CurrentBasePositive2, CurrentBasePositive3); pathTop.AddLine (CurrentBasePositive3, CurrentBasePositive0); pevent.Graphics.DrawPath (parent.ChartDescription.ColumnPen, pathTop); }
virtual internal void DisplayAsLinear (System.Windows.Forms.PaintEventArgs pevent, Chart parent, ChartColumn previousColumn, int columnWidthNoMargin, int verticalAxisMaxValueInPixels, Point base0, Point base1, Point base2, Point base3, Point prevBase0, Point prevBase1, Point prevBase2, Point prevBase3) { Debug.Assert (parent.ChartDescription.RenderingMode == ChartRenderingMode.Linear3d, "ChartColumn.DisplayBars", "Rendering mode not yet managed"); // First column, nothing to draw if (previousColumn == null) return; // Draw all values for (int i = 0; i < this.m_Values.Length; i++) { Color currentColor = parent.ChartDescription.GetPredefinedColor (i); Brush CurrentBrush = new SolidBrush (currentColor); Brush CurrentBrushDarken = new SolidBrush (Color.FromArgb (currentColor.A, currentColor.R /2, currentColor.G /2, currentColor.B /2)); // Compute points int prevY = prevBase0.Y - (previousColumn.m_Values[i] * verticalAxisMaxValueInPixels / (parent.ChartDescription.VerticalAxisMaxValue - parent.ChartDescription.VerticalAxisMinValue)); int y = base0.Y - (this.m_Values[i] * verticalAxisMaxValueInPixels / (parent.ChartDescription.VerticalAxisMaxValue - parent.ChartDescription.VerticalAxisMinValue)); Point currentPoint0 = new Point (prevBase0.X + columnWidthNoMargin / 2, prevY); Point currentPoint1 = new Point (base0.X + columnWidthNoMargin / 2, y); Point currentPoint2 = new Point (base3.X + columnWidthNoMargin / 2, y - parent.ChartDescription.DeltaDepth); Point currentPoint3 = new Point (prevBase3.X + columnWidthNoMargin / 2, prevY - parent.ChartDescription.DeltaDepth); // Local top value path GraphicsPath pathSubValues = new GraphicsPath (); pathSubValues.AddLine (currentPoint0, currentPoint1); pathSubValues.AddLine (currentPoint1, currentPoint2); pathSubValues.AddLine (currentPoint2, currentPoint3); pathSubValues.AddLine (currentPoint3, currentPoint0); if (prevY > y) pevent.Graphics.FillPath (CurrentBrushDarken, pathSubValues); else pevent.Graphics.FillPath (CurrentBrush, pathSubValues); } }