A Simple Data Table

Tables are often used very effectively in combination with other charts to add summarized information. For example a plot of a stock price might include a small table of the low and high values for the past year, and maybe a comparison with the industry sector.

SharpPlot treats each array-element in the argument as a column of data, and uses the X-labels as the column headers, with the Y-labels as the row-stubs. The Y-caption is used here to label the cell in the top-left corner.

If a simple array of numbers is passed, it is treated as a one-column table.

Table1
SharpPlot sp = new SharpPlot();
column1 = new int[] {18,27,31,1,1};
column2 = new int[] {120,34,27,18,8};

sp.SetYLabels(new string[]{"North","South","East","West","Other"});
sp.SetXLabels(new string[]{"2004","2005"});

sp.YCaption = "Regional\nTotals";

sp.TableStyle = TableStyles.Boxed|TableStyles.GridLines;

sp.SetValueFont("ARB",12);
sp.ValueTagFormat = "##0.0";

sp.SetLabelFont("ARB",13);
sp.SetCaptionFont("ARB",13);

sp.DrawTable(new int[][]{column1,column2});

See also

Table1 Table2 Table3 Table4