static void Main(string[] args) { var igs = new InfoGraphicsPy.Session(); igs.NewDocument(); TestDraw(igs); }
public void Draw(Session session) { var normalized_values = this.DataPoints.GetNormalizedValues(); var heights = DOMUtil.ConstructPositions(this.DataPoints.Count(), CellHeight, this.VerticalSeparation); var widths = DOMUtil.ConstructPositions(new[] { this.CategoryLabelHeight, this.CellWidth }, this.HorizontalSeparation); var grid = new GridLayout(widths, heights); int catcol = 0; int barcol = 2; var content_rects = this.SkipOdd(grid.GetRectsInCol(barcol)).ToList(); var domshapescol = new VA.DOM.ShapeList(); var bar_rects = new List<VA.Drawing.Rectangle>(content_rects.Count); for (int i = 0; i < content_rects.Count; i++) { var r = content_rects[i]; domshapescol.DrawRectangle(r); var size = new VA.Drawing.Size(normalized_values[i] * r.Width, this.CellHeight); var bar_rect = new VA.Drawing.Rectangle(r.LowerLeft, size); bar_rects.Add(bar_rect); } var cat_rects = this.SkipOdd(grid.GetRectsInCol(catcol)).ToList(); var bar_shapes = DOMUtil.DrawRects(domshapescol, bar_rects, session.MasterRectangle); var cat_shapes = DOMUtil.DrawRects(domshapescol, cat_rects, session.MasterRectangle); for (int i = 0; i < this.DataPoints.Count; i++) { bar_shapes[i].Text = new VA.Text.Markup.TextElement(this.DataPoints[i].Text); cat_shapes[i].Text = new VA.Text.Markup.TextElement(this.CategoryLabels[i]); } foreach (var shape in bar_shapes) { var cells = shape.Cells; cells.FillForegnd = this.ValueFillColor; cells.LineColor = this.LineLightBorder; } foreach (var shape in cat_shapes) { var cells = shape.Cells; cells.FillPattern = this.CategoryFillPattern; cells.LineWeight = this.CategoryLineWeight; cells.LinePattern = this.CategoryLinePattern; } domshapescol.Render(session.Page); }
public void Draw(Session session) { var pc = new VA.Layout.Models.Pie.PieLayout(); foreach (var dp in this.DataPoints) { pc.Add(dp.Value, dp.Text); } pc.DrawBackground = true; pc.Radius = 2.0; pc.Center = new VA.Drawing.Point(3,3); pc.Render(session.Page); }
public void Draw(Session session) { var normalized_values = DataPoints.GetNormalizedValues(); var widths = DOMUtil.ConstructPositions(DataPoints.Count(), this.CellWidth, HorizontalSeparation); var heights = DOMUtil.ConstructPositions(new[] { CategoryLabelHeight, CellHeight }, VerticalSeparation); var grid = new GridLayout(widths, heights); int catrow = 0; int barrow = 2; var top_rects = this.SkipOdd(grid.GetRectsInRow(barrow)).ToList(); var cat_rects = this.SkipOdd(grid.GetRectsInRow(catrow)).ToList(); var domshapescol = new VA.DOM.ShapeList(); var circle_shapes = new List<VA.DOM.Arc>(); var slice_shapes = new List<VA.DOM.Arc>(); for (int i = 0; i < DataPoints.Count; i++) { var dp = DataPoints[i]; var start = 0.0; var end = System.Math.PI * 2.0 * normalized_values[i]; double radius = top_rects[i].Width / 2.0; var circle_shape = domshapescol.DrawArc(top_rects[i].Center, radius * 0.7, radius, start, System.Math.PI * 2.0); circle_shapes.Add(circle_shape); var dom_shape = domshapescol.DrawArc(top_rects[i].Center, radius*0.7, radius, start, end); slice_shapes.Add(dom_shape); } var cat_shapes = DOMUtil.DrawRects(domshapescol, cat_rects, session.MasterRectangle); for (int i = 0; i < DataPoints.Count; i++) { slice_shapes[i].Text = new VA.Text.Markup.TextElement(DataPoints[i].Text); cat_shapes[i].Text = new VA.Text.Markup.TextElement(CategoryLabels[i]); } foreach (var shape in circle_shapes) { var cells = shape.Cells; cells.FillForegnd = NonValueColor; cells.LineColor = LineLightBorder; } foreach (var shape in slice_shapes) { var cells = shape.Cells; cells.FillForegnd = ValueFillColor; cells.LineColor = LineLightBorder; } foreach (var shape in cat_shapes) { var cells = shape.Cells; cells.FillPattern = CategoryFillPattern; cells.LineWeight = CategoryLineWeight; cells.LinePattern = CategoryLinePattern; } domshapescol.Render(session.Page); }