Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drilldown #203

Open
indiicheng opened this issue Feb 9, 2016 · 2 comments
Open

Drilldown #203

indiicheng opened this issue Feb 9, 2016 · 2 comments

Comments

@indiicheng
Copy link

Hey guys,

I looked, but wasn't able to find any documentation or help on StackOverflow on the correct syntax for utilizing a drill down. Can someone please provide me with an example?

Thanks,
Andy

@excel-tricks
Copy link

+1

Here's what I tried and got nowhere, unfortunately. It'll load the chart, but not the drill down.

@chart4 = LazyHighCharts::HighChart.new('collapsable') do |f|
  f.title(text: 'Sales for 2015')
  f.xAxis(categories: ['Cars', 'Fruits', 'Vegetables', 'Pets', 'Electronics'])
  f.series({
    name: 'Sales',
    colorByPoint: true,
    data: [
      {
        name: 'Cars',
        y: 5,
        drilldown: 'cars'
      }, {
        name: 'Fruits',
        y: 14,
        drilldown: 'fruits'
      }, {
        name: 'Vegetables',
        y: 12
      }, {
        name: 'Pets',
        y: 6
      }, {
        name: 'Electronics',
        y: 12,
        drilldown: 'electronics'
      }
    ]
  })

  f.drilldown({
    series: [ {
      id: 'cars',
      data: [
        ['Honda', 1],
        ['Toyota', 2],
        ['GM', 1],
        ['Nissan', 2]]
      }, {
      id: 'fruits',
      data: [
        ['Apples', 8],
        ['Bananas', 3],
        ['Cherries', 3]]
      }, {
      id: 'electronics',
      data: [
        ['iPhone', 3],
        ['iPad', 5],
        ['MacBook', 2],
        ['MacBook Air', 2]]
      } 
    ]
  })
  f.chart({defaultSeriesType: "column"})

  f.legend(layout: 'horizontal')
end

The compiled JavaScript looks exactly like this JavaScript example.

@arjan0307
Copy link
Contributor

I think this is due to the fact the module highcharts/modules/drilldrown is not required.

I am having more or less the same problem, and I wonder what the stance on highchart modules is. When I look in the vendor/assets/javascripts/highcharts/modules/ folder of this gem I only see exporting and no-data-to-display. What about all the other highcharts modules. How does this gem suggest that you include those?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants