BarGraph Documentation


Description

BarGraph is a class meant to create graphics in two diferent methods: file input or method calling.
The first method is better because you don't have to write almost no code and every settings can be on the file. The second is when you instanciate the class, call some design procedures, send data and draw the graph.

Methods

BarGraph::GetFinalGraphDimensions()
BarGraph::LoadGraph($path)
BarGraph::DrawGraph($path)
BarGraph::SetGraphAreaHeight($height)
BarGraph::SetAxisBackgroundColor($red, $green, $blue)
BarGraph::SetAxisBorderColor($red, $green, $blue)
BarGraph::SetBarBackgroundColor($red, $green, $blue)
BarGraph::SetBarBorderColor($red, $green, $blue)
BarGraph::SetBarData($data)
BarGraph::SetBarDimensions($width, $height)
BarGraph::SetBarPadding($padding)
BarGraph::SetAxisStep($step)
BarGraph::SetGraphBackgroundColor($red, $green, $blue)
BarGraph::SetGraphBorderColor($red, $green, $blue)
BarGraph::SetGraphBorderWidth($width)
BarGraph::SetGraphPadding($left, $top, $right, $bottom)
BarGraph::SetGraphTitle($title)
BarGraph::SetGraphTitleColor($red, $green, $blue)

BarGraph::GetFinalGraphDimensions()

After calling the methods you want, you can call this to know the final width and height of the image graph ;)

BarGraph::LoadGraph($path)

Loads a definition file with graph settings and data

BarGraph::DrawGraph($path)

Draws the graph. If path is given, graph will be sent directly to output. If not, it will be saved.

BarGraph::SetGraphAreaHeight($height)

This height is related to the graph area itself, not all the image. For you to understand what height am I talking: padding-top + areaheight + padding-bottom = image-height. For now you don't set the width of a graph but only the height (later that will be possible by putting the class calculating the side paddings).

BarGraph::SetAxisBackgroundColor($red, $green, $blue)

Let's you set the background color for the axis

BarGraph::SetAxisBorderColor($red, $green, $blue)

Let's you set the border color for the axis

BarGraph::SetBarBackgroundColor($red, $green, $blue)

Let's you set the background color for the bars

BarGraph::SetBarBorderColor($red, $green, $blue)

Let's you set the border color for the bars

BarGraph::SetBarData($data)

Let's you set the data of the bars. The argument should be an array where the key is the name of the bar and the value is the y value of the bar (only non negative)

BarGraph::SetBarDimensions($width, $height)

Let's you set the dimensions (width and height) of the bar. This is for better 3D viewing

BarGraph::SetBarPadding($padding)

Let's you set the padding of the bars (left and right)

BarGraph::SetAxisStep($step)

Let's you set the step on the axis scale (2, 3, 10, 20, 50, 100, ...)

BarGraph::SetGraphBackgroundColor($red, $green, $blue)

Let's you set the background color for the graph image

BarGraph::SetGraphBorderColor($red, $green, $blue)

Let's you set the border color for the graph image

BarGraph::SetGraphBorderWidth($width)

Let's you set the border width of the graph image (0 disables it as well as no argument)

BarGraph::SetGraphPadding($left, $top, $right, $bottom)

Let's you set paddings around all the graph.

BarGraph::SetGraphTitle($title)

Let's you set the title for the graph.

BarGraph::SetGraphTitleColor($red, $green, $blue)

Let's you set the color for the title of the graph

Examples

Definition file
How to load a definition file