在Highcharts图表上滚动 [英] Scrolling over highcharts graph

查看:143
本文介绍了在Highcharts图表上滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里是我的问题:
我使用phonegap框架来开发一个混合应用程序,我需要这个应用程序有图,我决定使用highcharts库。

Here's my issue: I am using the phonegap framework to develop a hybrid app, and I need this application to have graphs for which I had decided to use the highcharts library.

问题是,我触摸图表后似乎无法滚动(至少在触摸图像的选定部分内部)。

The problem is that I can't seem to be able to scroll after touching on the chart (at least while touching inside the selected portion of the image).

想要做的是防止图表采取任何事件,并显示任何突出显示的任何东西,并且能够滚动,即使im做它在图表上的简单图。

What I want to do is prevent the chart from taking any events and show a plain graph with anything being highlighted and be able to scroll even if im doing it over the graph.

代码:

chart1 = new Highcharts.Chart({
  chart: {
    renderTo: 'containerBar',
    animation: false,
    type: 'bar',
    events: {
      click: function(event){
        return false;
      }
    }
  },
  scrollbar: {
    enabled: true
  },
  title: {
    text: 'Fruit Consumption'
  },
  plotOptions: {
    bar: {
      events: {
        click: function(event){
          return false;
        },
        mouseOver: function(event){
          return false;           
        },
        legendItemClick: function () {
          return false;
        }
      },
      states: {
        hover: function(){
          alert("Allow");
        }
      }
    }
  },
  events: {
    click: function(e) {
      alert("Click");
    }  
  },
  xAxis: {
    categories: ['Apples', 'Bananas', 'Oranges']
  },
  yAxis: {
    title: {
      text: 'Fruit eaten'
    }
  },
  tooltip: {
    enabled: false
  },
  series: [{
    name: 'Jane',
    data: [1, 3, 4]
  }, {
    name: 'John',
    data: [5, 7, 3]
  }]
});


推荐答案

尝试此 link ....
只需制作一个单独的javascript文件,复制粘贴代码并包含文件

Try this link .... Just make a separate javascript file ,copy paste the code and include the file

这篇关于在Highcharts图表上滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆