如何使用json for Wind rose polar highchart insted of table data

时间:2015-10-01 11:02:23

标签: json highcharts

 data: {
        table: 'freq',
        startRow: 1,
        endRow: 17,
        endColumn: 7
    },

请帮助,如何使用json for Wind rose polar highchart代替表数据。 https://jsfiddle.net/id10922606/26njzy7k/1/

2 个答案:

答案 0 :(得分:2)

我在这里很晚,但是为可能会访问该问题的其他人发布了答案。我也努力做到这一点。相关问题中的答案并不完全明白,因为在处理极风玫瑰时没有使用原始风速而不是风速,而没有来自高图演示中的示例的表数据。

极地版本类似于堆积列图表,只能将其视为围绕圆圈的x轴。 x轴显示风向,类别选项定义这些。 y轴显示风速桶。系列数据的结构为

         //data series
         {
            //series 1
            name: '10-20 kmph',
            //basically the frequencies for that wind speed across all the directions
            //1.5% comes from N, 4.5% from NNE, 3.0% from NE, etc 
            data: [1.5, 4.5, 3.0, 0 ... ]
         },
         {
            //series 2
            name: '20-30 kmph',
            data: [1.2, 3.6, 0, .... ]
         }
         //so on

我使用的代码在这里,它通过json:

获取频率数据
          //chart no.1 - wind rose
          $scope.windRoseConfig = {
              options: {
                  chart: { polar: true, type: 'column' },
                  yAxis: {
                     title: { text: 'Frequency' }, 
                     reversedStacks: false
                  },
                  plotOptions: {
                     series: {
                        stacking: 'normal',
                        shadow: false,
                        groupPadding: 0,
                        pointPlacement: 'on'
                     }
                  }
              },

              title: { text: 'Wind Rose' },

              series: seriesData,

              xAxis: {
                  tickmarkPlacement: 'on',
                  categories: [ "N", "NNE", "NE", "ENE", "E", "ESE", "SE", "SSE", "S", "SSW", "SW", "WSW", "W", "WNW", "NW", "NNW" ]
              }
          }

       }

答案 1 :(得分:0)

您可以在此处找到使用JSON的演示:Demo

series: [
    {
      name: '10-20 kmph',
      data: [1.5, 4.5, 3.0, 1.5, 4.5, 3.0, 1.5, 4.5, 3.0, 1.5, 4.5, 3.0, 1.5, 4.5, 3.0, 1.5]
    },
    {
      name: '20-30 kmph',
      data: [1.5, 4.5, 3.0, 1.5, 4.5, 3.0, 1.5, 4.5, 3.0, 1.5, 4.5, 3.0, 1.5, 4.5, 3.0, 1.5]
    }
],
xAxis: {
    tickmarkPlacement: 'on',
    categories: ["N", "NNE", "NE", "ENE", "E", "ESE", "SE", "SSE", "S", "SSW", "SW", "WSW", "W", "WNW", "NW", "NNW"]
},