Tuesday, 8 May 2007
Article: Generate Bar Chart HTML Generator in PHP |
| |
|
| |
AnyExample.com has an article running that contains PHP function ae_bar_html for generating HTML/CSS based one-column bar charts. It is suitable for simple diagrams and does not require libgd.
The author lists that this is compatible with the following:
- PHP 4, PHP 5 or higher
- Any sane browser with CSS support
- Internet Explorer 5+
The described function ae_bar_html uses four arguments:
- - associative array of values: array keys are category titles, array values are chart values. Values should be positive numbers (integers or floats)
- (default: 400px) - specify height of longest (maximum value) bar
- (default: 'black') - specify color of each column
- (default: 'auto') - specify width of each column.
This version of the function uses inline CSS (style=""). The author informs that resulting HTML code may be inserted anywhere, however inline CSS is quite messy and additional styling requires modifying of the function source.
The author talks about another version of the function, ae_bar_css which outputs 'clean' HTML code with CSS classes specified. All color and width settings are done in CSS class definition. You need to specify only three arguments: values, height and CSS-prefix. CSS-prefix argument is a string which will be added before every CSS class. This may be useful if you need to insert several charts with different styles.
At the end, it must be noted that the function works only with positive values. Negative values are converted to positive. |
| |
|
Read the Post
|
| |
|
|
| |
|
|
| |
|