tipos lineas grafica español ejemplo data javascript highcharts

javascript - lineas - manual highcharts español



Desactivar, haga clic en Leyenda en el gráfico de columnas de HighCharts (4)

Simplemente estoy tratando de deshabilitar el efecto DRILL-DOWN en mi ''Gráfico de columnas''. ¿Alguien puede ayudar? Aquí está el código de ejemplo en Fiddle http://jsfiddle.net/D8Ez3/

* Como puedes ver, la leyenda del gráfico es cliqueable. Necesito que no se pueda hacer clic en los elementos de la leyenda porque al hacer clic en todos los elementos, el gráfico se muestra vacío. Prefiero no tener ningún desglose para el gráfico. ¿Algunas ideas?

chart = new Highcharts.Chart({ chart: { renderTo: ''impact'', type: ''column'', margin: [0, 0, 0, 0], spacingTop: 0, spacingBottom: 0, spacingLeft: 0, spacingRight: 0, backgroundColor: null, events: { load: function (event) { console.log(this); }}}, exporting: { buttons: { exportButton: { enabled:false }, printButton: { enabled:false }}}, credits: { enabled: false }, title: { text: '''' }, subtitle: { text: '''' }, xAxis: { categories: [''Reporting Year''] }, yAxis: { min: 0, title: { text: ''Millions (mm)'' } }, legend: { enabled:false, layout: ''vertical'', backgroundColor: ''#FFFFFF'', align: ''left'', verticalAlign: ''top'', x: 50, y: 30, floating: true, shadow: true }, tooltip: { formatter: function () { return '''' + this.x + '': '' + this.y + '' mm''; } }, plotOptions: { column: { pointPadding: 0.2, size: ''95%'', borderWidth: 0}, point: { events: { legendItemClick: function () { return true; // <== returning false will cancel the default action }}}, allowPointSelect: false, }, series: [{ name: ''Yr 1'', data: [23.7] }, { name: ''Yr 2'', data: [13.6] }, { name: ''Yr 3'', data: [49.9] }, { name: ''Yr 4'', data: [83.6] }] });


Aquí hay un JSFiddle demuestra cómo lograr esto:

plotOptions: { series: { events: { legendItemClick: function () { var visibility = this.visible ? ''visible'' : ''hidden''; if (!confirm(''The series is currently '' + **strong text** visibility + ''. Do you want to change that?'')) { return false; } } } } }


Esta es la forma de hacer que las leyendas del gráfico de Highcharts no sean seleccionables porque cada vez que haga clic en una leyenda particular, la división correspondiente desaparecerá del gráfico, por lo que debe hacer que el gráfico persista según los requisitos del negocio, podemos hacer que las leyendas no se puedan hacer clic.

plotOptions: { column: { pointPadding: 0, borderWidth: 1, }, series: { events: { legendItemClick: function (e) { e.preventDefault(); } } } }


Estabas cerca En lugar de:

plotOptions: { column: { pointPadding: 0.2, size: ''95%'', borderWidth: 0 }, point: { events: { legendItemClick: function () { return false; // <== returning false will cancel the default action } } }, allowPointSelect: false, },

Usted quiere:

plotOptions: { column: { pointPadding: 0.2, size: ''95%'', borderWidth: 0, events: { legendItemClick: function () { return false; } } }, allowPointSelect: false, },


Y si trabajas con pasteles, debes hacer:

pie: { showInLegend: true, allowPointSelect: false, point:{ events : { legendItemClick: function(e){ e.preventDefault(); } } } }