2016-04-21 3 views
1

Диалоговое контекстное меню появляется дважды в одном и том же графике после каждого нажатия кнопки. Я вставил свой код ниже. Любая помощь приветствуется. Заранее спасибо. Пожалуйста, проверьте экспортирующие варианты в коде нижеГрафик высоких диаграмм Контекстное меню появляется дважды на одном графике

function GenerateChartPulledRate(title, ctrl, CountText, CountVal) { 
    if (CountText.length > 0) { 
     $('#divPulled' + ctrl + '').empty(); 
     $("#divChartPulled" + ctrl).show(); 

     $("#divNoDataPulled" + ctrl).hide(); 
     $("#divNoDataHeaderPulled" + ctrl).hide(); 
     $('#divPulled' + ctrl + '').highcharts({ 
      chart: { 
       events: { 
        load: function() { 
         // debugger; 
         this.myTooltip = new Highcharts.Tooltip(this, this.options.tooltip); 
         this.setSize(PulledRateWidth, PulledRateHeight); 
        }, 
       } 
      }, 
      credits: { 
       enabled: false 
      }, 
      title: { 
       text: title 
      }, 
      tooltip: { 
       enabled: false, 
       positioner: function (boxWidth, boxHeight, point) { 
        return { x: 120, y: 0 }; 
       } 
      }, 
      plotOptions: { 
       series: { 
        stickyTracking: false, 
        events: { 
         click: function (evt) { 
          //debugger; 
          if (Unitteamcount == 1) { 
           // $('#divPulledRate .highcharts-tooltip').show(); 
           $('#divPulledUnit .highcharts-tooltip').hide(); 
           Unitteamcount = 0; 
          } 

          if (Rateteamcount == 0) { 
           SelRateTeam = evt.point.category; 
           $('#divPulledRate .highcharts-tooltip').show(); 
           this.chart.myTooltip.refresh(evt.point, evt); 
           Rateteamcount = 1; 
          } 
          else if (SelRateTeam != evt.point.category) { 
           $('#divPulledRate .highcharts-tooltip').show(); 
           this.chart.myTooltip.refresh(evt.point, evt); 
           SelRateTeam = evt.point.category; 
          } 
          else { 
           this.chart.myTooltip.hide(); 
           Rateteamcount = 0; 
          } 
         }, 

        } 
       } 
      }, 
      xAxis: { 
       categories: CountText 
      }, 

      yAxis: { 
       title: null 
      }, 
      series: [{ 
       name: 'Actual DPU Rate', 
       type: 'column', 
       data: CountVal, 
       color: "#ffa238", 
       showInLegend: false, 
      }, 
      ], 
      exporting: { 

       buttons: { 
        contextButton: { 

         menuItems: [{ 
          text: '<img src="images/Export.png" title="Export"/>', 

          onclick: function() { 
           this.exportChart({ 
            type: 'application/pdf', 
            filename: 'RateofDefectPerUnitbyTeam' 
           }); 
          } 
         }, 
         { separator: true }, 
         { 
          text: '<img src="images/PrintChart.png" title="Print"/>', 
          onclick: function() { 
           this.print(); 
          } 
         }, 
         { separator: true }, 
          { 
           text: '<img src="images/maxi.png" title="Maximize"/>', 
           onclick: function() { 
            var maxCount = 0; 
            $("#divPulledChartFullView").html(""); 
            $("#divPulledChartFullView").css("min-width", "1800px").css("max-width", "2000px") 
            if (PulledRateInterval != undefined) { 
             clearInterval(PulledRateInterval); 
            } 
            if (maxCount == 0) { 
             GeneratePulledChartRateFullView(title, ctrl, CountText, CountVal); 
            } 
            if (PulledUnitInterval != undefined) { 
             clearInterval(PulledUnitInterval); 
            } 
            PulledRateInterval = setInterval(function() { GeneratePulledChartRateFullView(title, ctrl, CountText, CountVal); }, 60000); 
            maxCount++; 
            $("#divPulledChartFullView").dialog({ 
             modal: true, 
             resizable: false, 
             draggable: false, 

             minHeight: 750, 
             maxHeight: 1000, 
             position: { my: "top", at: "top+199" }, 
             buttons: { 
              Close: function() { 
               if (PulledRateInterval != undefined) { 
                clearInterval(PulledRateInterval); 
               } 
               $(this).dialog('close'); 
              } 
             }, 
             open: function (event, ui) { $(".ui-button-text").hide(); $(".ui-dialog").css({ 'min-height': '728px' }); $("#divPulledChartFullView").css({ 'min-height': '649px' }); $("#divPulledChartFullView").css({ 'max-height': '899px' }); $(".ui-dialog").css({ 'top': '199px' }); $(".ui-dialog").css({ 'left': '23px' }); $(".ui-dialog").css({ 'width': '97.5%' }); $("#divPulledChartFullView").css({ 'top': '17px' }); $("#divPulledChartFullView").css({ 'left': '10px' }); $("button[title='Close']").removeClass("ui-button ui-widget ui-state-default ui-corner-all ui-button-icon-only ui-dialog-titlebar-close").addClass("ui-button ui-widget ui-state-default ui-corner-all ui-button-icon-only ui-dialog-titlebar-close ui-state-hover") } 
            }); 
            $("button[title='Close']").mouseout(function() { 
             $("button[title='Close']").addClass("ui-button ui-widget ui-state-default ui-corner-all ui-button-icon-only ui-dialog-titlebar-close ui-state-hover") 
            }); 

            // $(".ui-dialog ui-widget ui-widget-content ui-corner-all ui-front ui-dialog-buttons ui-draggable").css("top","201px").css("left","36px") 
            return false; 


           } 
          } 

         ] 
        } 
       } 
      } 
     }) 
    } 
    else { 
     $("#divChartPulled" + ctrl).hide(); 
     $("#divNoDataPulled" + ctrl).show(); 
     $("#divNoDataHeaderPulled" + ctrl).show(); 
     $("#divNoDataPulled" + ctrl).addClass("csNoData csNoDataMargin"); 
    } 
} 

ответ

0

Скорее всего, это происходит потому, что вы включили Highcharts экспортирующих библиотек несколько раз на вашей странице. У меня была такая же проблема, и она была исправлена ​​после удаления избыточного импорта.

Смежные вопросы