There's a few Horizontal Bar charts on this page that all demonstrate the various scale combinations that you can have.
<script src="RGraph.svg.common.core.js"></script> <script src="RGraph.svg.hbar.js"></script>Put this where you want the chart to show up:
<div style="width: 400px; height: 450px" id="chart-container1"></div></div> <div style="width: 400px; height: 450px" id="chart-container2"></div></div> <div style="width: 500px; height: 550px" id="chart-container3"></div></div> <div style="width: 500px; height: 450px" id="chart-container4"></div></div> <div style="width: 500px; height: 450px" id="chart-container5"></div></div> <div style="width: 500px; height: 450px" id="chart-container6"></div></div>This is the code that generates the chart:
<script> new RGraph.SVG.HBar({ id: 'chart-container1', data: [-5,-7,-9,-11,-13,-15], options: { marginLeftAutosize: false, marginLeft: 15, marginRight: 50, xaxisScaleMax: -5, xaxisScaleMin: -15, yaxisLabels: ['Harry','Lucy','Pete','Nick','Al','John'], title: 'Both min and max negative', } }).draw(); new RGraph.SVG.HBar({ id: 'chart-container2', data: [0,1,2,3,4,5,6], options: { xaxisScaleMax: 10, yaxisLabels: ['Harry','Lucy','Pete','Nick','Al','John','Kevin'], title: 'Min set to zero and max positive', vmargin: 10, backgroundGridHlines: false, backgroundGridBorder: false, xaxis: false, yaxis: false } }).draw(); new RGraph.SVG.HBar({ id: 'chart-container3', data: [10,9,8,7,6,5,4,3,2,1,0,-1,-2,-3,-4,-5,-6,-7,-8,-9,-10], options: { xaxisScaleMin: 'mirror', yaxisLabels: [ 'Harry','Lucy','Pete','Nick','Al','John','Kerridge', 'Harry','Lucy','Pete','Nick','Al','John','Kerridge', 'Harry','Lucy','Pete','Nick','Al','John','Kerridge' ], title: 'Min negative and max positive', backgroundGridHlines: false, backgroundGridBorder: false, colors: [ 'red', 'blue','green', 'red', 'blue','green', 'red', 'blue','green', 'red', 'blue','green', 'red', 'blue','green', 'red', 'blue','green', 'red', 'blue','green' ], colorsSequential: true, } }).draw(); new RGraph.SVG.HBar({ id: 'chart-container4', data: [5,6,7,8,9,10], options: { marginRight: 190, title: 'Both min and max above zero', yaxisLabels: ['Ken','Larry','Kevin','Jobe','Lucy','John'], xaxisScaleMin: 5, xaxisScaleMax: 10, backgroundGridBorder: false, backgroundGridHlines: false } }).draw(); new RGraph.SVG.HBar({ id: 'chart-container5', data: [-1,-2,-3,-4,-5,-6,-7,-8,-9,-10], options: { marginLeftAutosize: false, marginLeft: 15, marginRight: 50, title: 'Zero max and negative min', yaxisLabels: ['Ken','Larry','Kevin','Jobe','Lucy','John'], xaxisScaleMin: -10, xaxisScaleMax: 0, backgroundGridBorder: false, backgroundGridHlines: false } }).draw(); new RGraph.SVG.HBar({ id: 'chart-container6', data: [-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20], options: { colors: ['Gradient(red:white:red:red:#c00:#600)'], vmargin: 1, title: 'Offset axis, negative min positive max', xaxisScaleMin: -5, xaxisScaleMax: 20, backgroundGridBorder: false, backgroundGridHlines: false } }).draw(); </script>