A simple Rose chart
Here's a simple Rose chart
that can be quite easily used as a traditional Wind Rose chart
(ie based on a compass with larger segments indicating stronger winds).
The canvas
Rose can be stacked
or non-equi-angular
and there's also an svg
version
of it. The svg
version can also be configured in a stacked
+ non-equi-angular
configuration
(the canvas
version can't do this). There's a demo of that in the download called
svg-rose-non-equi-angular-stacked.html
Though the canvas
Rose can be configured to have a 3D appearance.
There's a demo of the 3D Rose online and
in the download.
The svg
Rose also has a segmentsAngleOffset
property. This property allows you to
rotate the segments slightly and by using two Rose charts
- one with a positive offset
and one with a negative offset you can get a grouped effect to the chart. This is shown
by a demo in the download called svg-rose-grouped.html
For smaller screens, the text is smaller and there's no css
float
applied to the svg
tag.
This goes in the documents header:
<script src="RGraph.common.core.js"></script> <script src="RGraph.rose.js"></script>Put this where you want the chart to show up:
<div style="float: right"> <canvas id="cvs" width="600" height="400">[No canvas support]</canvas> </div>This is the code that generates the chart - it should be placed AFTER the
canvas
tag(s):
<script> // This is a simple example of the Rose chart that's been configured // with some labels that are positioned around the Rose chart. rose = new RGraph.Rose({ id: 'cvs', data: [4,6,3,5,2,8,9], options: { labels: ['Luna','Kevin','Richard','John','Dave','Bob','Paul'], // Add some responsive capabilities. The chart doesn't // change much - it mostly just reduces in size. responsive: [ {maxWidth: null,width:600,height:400,options:{textSize:12},parentCss:{'float':'right',textAlign:'none'}}, {maxWidth: 900,width:400,height:300,options:{textSize:10},parentCss:{'float':'none',textAlign:'center'}} ] } // Draw the chart }).draw(); </script>