/// <summary> /// Creates the legend item for a value. /// </summary> /// <param name="text">string</param> /// <param name="indexColumn">int</param> /// <param name="indexRow">int</param> /// <param name="indexColor">int</param> protected virtual void GenerateLegendItem(string text, ref int indexColumn, ref int indexRow, int indexColor) { int x = 0; int y = 0; Text txt; if (this.LegendArea.Y + ((rectLegendSpace + rectLegendHeight) * indexRow) > (this.legendArea.Y + this.legendArea.Height)) { indexColumn++; indexRow = 0; } x = this.legendArea.X + (indexColumn * ((maxLengthLegendText * (weightChar / 2)) + rectLegendSpace * 4)); y = this.LegendArea.Y + ((rectLegendSpace + rectLegendHeight) * indexRow); SvgDocument.Rectangle rect = new SvgDocument.Rectangle(rectLegendWidth, rectLegendHeight); rect.X = x; rect.Y = y; rect.Color = this.colors[indexColor]; this.doc.SvgObjects.Add(rect); text = text.ToLower(); if (text.Length > 15) { text = text.Substring(0, maxLengthLegendText); } txt = new Text(text); txt.X = x + rectLegendWidth + rectLegendSpace; txt.Y = y + rectLegendHeight; txt.Font_Size = weightChar; this.doc.SvgObjects.Add(txt); }
/// <summary> /// Creates x and y Axis /// </summary> protected void GenerateAxis() { #region Axis this.lineX = new Line(this.X1Axis.X, this.X1Axis.Y, this.X2Axis.X, this.X2Axis.Y); this.lineX.Width = (decimal)0.4; this.lineX.Color = Color.Gray; this.lineY = new Line(this.Y2Axis.X, this.Y2Axis.Y, this.Y1Axis.X, this.Y1Axis.Y); this.lineY.Width = (decimal)0.4; this.lineY.Color = Color.Gray; #endregion Axis #region Y Legend double value = 0; double legendValue = 0; short fontSize = 7; double xStartPos = this.X2Axis.X + 5; this.tpcmaxFillFactor = Convert.ToDouble((this.Y1Axis.Y - this.Y2Axis.Y) / 100.0); double scallability = (this.maxFillFactor - this.minFillFactor) / 4; value = 0 * tpcmaxFillFactor; double y1 = this.X1Axis.Y - value; AddTextLegend(xStartPos, y1, fontSize, this.minFillFactor); if (!(this.MaxValue == 0 && this.MinValue == 0)) { value = 25 * tpcmaxFillFactor; legendValue = (scallability + this.minFillFactor); double y4 = this.X1Axis.Y + value; AddTextLegend(xStartPos, y4, fontSize, legendValue); value = 50 * tpcmaxFillFactor; legendValue = ((scallability * 2) + this.minFillFactor); double y2 = this.X1Axis.Y + value; AddTextLegend(xStartPos, y2, fontSize, legendValue); value = 75 * tpcmaxFillFactor; legendValue = ((scallability * 3) + this.minFillFactor); double y5 = this.X1Axis.Y + value; AddTextLegend(xStartPos, y5, fontSize, legendValue); value = 100 * tpcmaxFillFactor; double y3 = this.X1Axis.Y + value; AddTextLegend(xStartPos, y3, fontSize, this.maxFillFactor); if (!this.backgroundColor.IsEmpty) { SvgDocument.Rectangle rect = new SvgDocument.Rectangle(this.X2Axis.X - this.X1Axis.X, this.Y2Axis.Y - this.Y1Axis.Y); rect.X = this.x1.X; rect.Y = this.Y1Axis.Y; rect.Color = this.backgroundColor; this.Doc.SvgObjects.Add(rect); } if (this.withGuideLines) { Line lin1 = new Line(xStartPos, y2, this.lineX.X1, y2); lin1.Color = Color.Gray; lin1.Width = (decimal)0.2; lin1.Dashed = true; Line lin2 = new Line(xStartPos, y3, this.lineX.X1, y3); lin2.Color = Color.Gray; lin2.Width = (decimal)0.2; lin2.Dashed = true; Line lin3 = new Line(xStartPos, y4, this.lineX.X1, y4); lin3.Color = Color.Gray; lin3.Width = (decimal)0.2; lin3.Dashed = true; Line lin4 = new Line(xStartPos, y5, this.lineX.X1, y5); lin4.Color = Color.Gray; lin4.Width = (decimal)0.2; lin4.Dashed = true; this.Doc.SvgObjects.Add(lin1); this.Doc.SvgObjects.Add(lin2); this.Doc.SvgObjects.Add(lin3); this.Doc.SvgObjects.Add(lin4); } } #endregion Y Legend this.Doc.SvgObjects.Add(lineX); this.Doc.SvgObjects.Add(lineY); }