Wind rose

author(s): Torstein Hønsi

by Kesav Telaprolu

HTML

<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/highcharts-more.js"></script>
<script src="https://code.highcharts.com/modules/data.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<script src="https://code.highcharts.com/modules/export-data.js"></script>
<script src="https://code.highcharts.com/modules/accessibility.js"></script>

<figure class="highcharts-figure">
    <div id="container"></div>
    <p class="highcharts-description">
        The wind rose chart is often used to visualize wind patterns. In this
        example, the chart shows the wind speed distribution. This is
        achieved with a polar stacked column chart.
    </p>
</figure>

<div style="display:none">
    <!-- Source: http://or.water.usgs.gov/cgi-bin/grapher/graph_windrose.pl -->
    <table id="freq" border="0" cellspacing="0" cellpadding="0">
        <tr nowrap bgcolor="#CCCCFF">

        </tr>
       
       
      
       
      
      
        <tr nowrap>
           
            <td class="data">2.66</td>
            <td class="data">4.74</td>
            <td class="data">0.43</td>
            <td class="data">0.00</td>
            <td class="data">0.00</td>
            <td class="data">0.00</td>
            <td class="data">0.00</td>
            <td class="data">7.83</td>
        </tr>
        <tr nowrap bgcolor="#DDDDDD">
           
            <td class="data">2.96</td>
            <td class="data">4.14</td>
            <td class="data">0.26</td>
            <td class="data">0.00</td>
            <td class="data">0.00</td>
            <td class="data">0.00</td>
            <td class="data">0.00</td>
            <td class="data">7.37</td>
        </tr>
        <tr nowrap>
           
            <td class="data">2.53</td>
            <td class="data">4.01</td>
            <td class="data">1.22</td>
            <td class="data">0.49</td>
            <td class="data">0.13</td>
          ...

CSS

.highcharts-figure, .highcharts-data-table table {
    min-width: 360px; 
    max-width: 660px;
    margin: 1em auto;
}

.highcharts-data-table table {
	font-family: Verdana, sans-serif;
	border-collapse: collapse;
	border: 1px solid #EBEBEB;
	margin: 10px auto;
	text-align: center;
	width: 100%;
	max-width: 500px;
}
.highcharts-data-table caption {
    padding: 1em 0;
    font-size: 1.2em;
    color: #555;
}
.highcharts-data-table th {
	font-weight: 600;
    padding: 0.5em;
}
.highcharts-data-table td, .highcharts-data-table th, .highcharts-data-table caption {
    padding: 0.5em;
}
.highcharts-data-table thead tr, .highcharts-data-table tr:nth-child(even) {
    background: #f8f8f8;
}
.highcharts-data-table tr:hover {
    background: #f1f7ff;
}

JavaScript

// Parse the data from an inline table using the Highcharts Data plugin
Highcharts.chart('container', {
    data: {
        table: 'freq',
        startRow: 1,
        endRow: 2,
       endColumn: 4
    },

    chart: {
        polar: true,
        type: 'column'
    },

    title: {
        text: 'Wind rose for South Shore Met Station, Oregon'
    },

    subtitle: {
        text: 'Source: or.water.usgs.gov'
    },

    pane: {
        size: '100%'
    },

  
    xAxis: {
        tickmarkPlacement: 'off',
        enabled:false
    },
    legend:{
     enabled : false,
    },
    yAxis: {
        min: 0,
         gridLineWidth: 0,
            lineColor: '#dbdbdb',
            lineWidth: 0,
            
        //endOnTick: false,
        //showLastLabel: true,
        title: {
            text: ''
        },
        labels: {
            formatter: function () {
                return'';
            }
        },
        reversedStacks: false
    },

    tooltip: {
        valueSuffix: '%'
    },

    plotOptions: {
        series: {
            stacking: 'normal',
            shadow: false,
            groupPadding: 0,
            pointPlacement: 'on'
        }
    },
    series:[{
    
    }]
});