The Bi-polar chart is good for comparing two things side by side. For example sales trends for two separate years, that you want to compare.
The example file is here.
<script> window.onload = function () { var left = [5,6,8,9,12,13,4,9]; var right = [5,8,4,11,15,26,13,16]; var bipolar = new RGraph.Bipolar('myBipolar', left, right); bipolar.Set('chart.colors', ['#fff', '#eef', '#ddf', '#ccf', '#bbf', '#bbf', '#aaf', '#99f']); bipolar.Set('chart.margin', 3); bipolar.Set('chart.labels', ['Barry', 'John', 'Fred', 'George', 'Rich', 'Larry', 'John', 'Mike']); bipolar.Set('chart.title.left', '2007'); bipolar.Set('chart.title.right', '2008'); bipolar.Set('chart.gutter', 35); bipolar.Draw(); } </script>
You can use these properties to control how the chart apears.
chart.margin | The space above and below each bar. Default: 2 |
chart.xtickinterval | The X tick mark interval. Default: 25 |
---|---|---|---|
chart.labels | An array of the graphs labels (they go in the middle). Default: null |
chart.text.size | The size of the text used. Default: 12 |
chart.title.left | The left title. Default: An empty string |
chart.title.right | The right title. Default: An empty string |
chart.colors | An array of colors. These too can be gradients that you make if you wish. Default: ['#fcf', '#00f', '#f00', '#0f0', '#ff0', '#0ff', '#f0f', '#ff6101', '#b401ff', '#e4ff01', '#fb8195', '#ccc'] |
chart.gutter | The space given over to the labels. Default: 25 |
chart.units.pre | The units that are applied to the X axis labels (these are preppended to the number). Default: none |
chart.units.post | The units that are applied to the X axis labels (these are appended to the number). Default: none |
chart.tooltips | A numerically indexed array of tooltips that are shown when a bar is clicked. These can contain HTML. Default: An empty array |
chart.tooltip.effect |
The animated effect used for showing tooltips. Can be either fade or expand.
Default: fade |
chart.shadow | Turns the shadow on or off. Default: false |
chart.shadow.color | The color of the shadow. Default: #666 |
chart.shadow.offsetx | The horizontal offset of the shadow. Default: 3 |
chart.shadow.offsety | The vertical offset of the shadow. Default: 3 |
chart.shadow.blur | How severe the blurring effect is for the shadow. Default: 3 |
chart.contextmenu | An array of context menu items. Cannot be used in conjunction with tooltips. Default: [] (An empty array) |
chart.annotatable |
Whether annotations are enabled for the chart (ie you can draw on the chart interactively.
Default: false |
chart.annotate.color |
If you do not allow the use of the palette, then this will be the only colour allowed for annotations.
Default: black |
chart.title.vpos |
This allows you to completely override the vertical positioning of the title. It should be a number between 0 and 1, and
is multiplied with the gutter and then used as the vertical position. It can be useful if you need to have a large gutter. Default: null |
chart.title.color | The color of the title. Default: black |
chart.xmax | This allows you to set the maximum X value that the chart uses, instead of it being auto-generated. Default: null |
chart.scale.decimals | This allows you to set the precision of the X labels. Default: null |
You can set these properties by using the Set() method. Eg:
myBipolar.Set('name', 'value');