0

嗨,我想从鼠标悬停时出现的 amchart 图中删除红色气球。谁能帮我解决这个问题

我的代码是

         var clicks   =document.getElementById('clicks').value;

         var cam_name   =document.getElementById('cam_name').value;

         var views =document.getElementById('views').value;
         var camp_clicks      =clicks.split('~');
         var camp_names   =cam_name.split('~');

         var  camp_imprs       =views.split('~');  
            //var camp_clicks      = [1,2,3,1.5,6,3,7];



        var chart;
        var chartData_camp = [];

    /*  var camp_names=['hi','hello','hw','r','u'];
        var camp_costs=[1,2,3,4,5];
        var camp_imprs=[1,2,3,4,5];
        var camp_clicks=[1,2,3,4,5];*/




    for (var i = 0; i < camp_names.length; i++) {

                chartData_camp.push({
                    camp_name: camp_names[i],

                    camp_click: camp_clicks[i]
                });
            }
        AmCharts.ready(function () {
            // generate some random data first


            // SERIAL CHART    
            chart = new AmCharts.AmSerialChart();
            chart.pathToImages = 'http://www.xxx.com/en/Images/';
            chart.zoomOutButton = {
                backgroundColor: '#fff',
                backgroundAlpha: 0.15
            };
            chart.dataProvider = chartData_camp;
            chart.categoryField = 'camp_name';
            //graph.balloonText = "[[balloon2]]";
            chart.balloon.showBullet = false;
            // listen for 'dataUpdated' event (fired when chart is inited) and call zoomChart method when it happens
            chart.addListener('dataUpdated', zoomChart);


        //  var cursorSettings = new AmCharts.ChartCursorSettings();
        //cursorSettings.valueBalloonsEnabled = false;


            // third value axis (on the left, detached)
            camp_clickAxis = new AmCharts.ValueAxis();
           // camp_clickAxis.offset = 50; // this line makes the axis to appear detached from plot area
          camp_clickAxis.gridAlpha = 0;
            camp_clickAxis.axisColor = '#3183D5';
            camp_clickAxis.axisThickness = 2;
            camp_clickAxis.balloonText = "";
            // camp_clickAxis.lineAlpha = 2;
            camp_clickAxis.lineColor = "#E5F3F9";
          //  camp_clickAxis.fillAlphas = 0.3; // setting fillAlphas to > 0 value makes it area graph

            chart.addValueAxis(camp_clickAxis);
            // GRAPHS


            // third graph
            var camp_clickGraph = new AmCharts.AmGraph();
            camp_clickGraph.valueAxis = camp_clickAxis; // we have to indicate which value axis should be used
            camp_clickGraph.type = "smoothedLine"; // this line makes the graph smoothed line.
            camp_clickGraph.valueField = 'camp_click';
           camp_clickGraph.title = ' ';
            camp_clickGraph.bullet = 'round';
            camp_clickGraph.bulletSize = 10;
            camp_clickGraph.lineColor = '#058DC7';
            camp_clickGraph.lineThickness  = 3;
            camp_clickGraph.hideBulletsCount = 30;
            camp_clickGraph.fillAlphas = 0.1;

            chart.addGraph(camp_clickGraph);

            // CURSOR
            var chartCursor = new AmCharts.ChartCursor();
            chartCursor.cursorPosition = 'mouse';
            chart.addChartCursor(chartCursor);

            // SCROLLBAR
            /*var chartScrollbar = new AmCharts.ChartScrollbar();
            chart.addChartScrollbar(chartScrollbar);*/

            // LEGEND
            var legend = new AmCharts.AmLegend();
            legend.marginLeft = 110;
            chart.addLegend(legend);

            // WRITE
            chart.write('camp_graph');

        });

        function zoomChart() {
            // different zoom methods can be used - zoomToIndexes, zoomToDates, zoomToCategoryValues
            chart = new AmCharts.AmSerialChart();
            chart.zoomToIndexes(0,30);
        }

嗨我

4

2 回答 2

5
chartCursor.categoryBalloonEnabled = false;
于 2014-04-14T11:30:35.500 回答
2

我找到了答案。为 javascript 图表添加此行以禁用气球

var chartCursor = new AmCharts.ChartCursor();           
chart.addChartCursor(chartCursor);
chartCursor.enabled=false;

文档在这里

于 2013-07-25T06:16:39.080 回答