iphone上的客户端事件不适用于morris条形图

时间:2017-05-22 12:37:38

标签: javascript jquery github morris.js

 <div class="chart chart-md" id="morrisStacked"> </div>              
 <script type="text/javascript">               
 $(document).ready(function () {      
        ajxCall = $.ajax({
                        type: "POST",       
                        url: "/Graph/GetBarData?Inst=" + Inst + "&TimeType=" + TimeType + "&time=" + time + "&AddSub=" + AddSubM + "&Inverters=" + InvList + "&InvId=" + InvId+"&DayEnergy="+estimate,      // Location of the service
                        data: "",       //Data sent to server
                        contentType: "application/json; charset=utf-8",
                        dataType: "json",   //Expected data format from server
                        success: function (result) {  //On Successful service call
                            Loader(false);
                            if (AddSub == 0) {
                                _Chart = Morris.Bar({
                                    resize: true,
                                    element: 'morrisStacked',
                                    data: result[0].data,
                                    ymax: result[0].Ymax,
                                    xkey: 'y',
                                    ykeys: result[0].ykeys,
                                    labels: result[0].labels,
                                    barColors: ['#0088cc', '#2baab1', '#8CC9E8', '#aa88cc', '#aaaab1', '#aaC9E8', '#bb88cc', '#bbaab1', '#bbC9E8', '#cc88cc', '#ccaab1', '#ccC9E8'],
                                    fillOpacity: 0.7,
                                    smooth: false,
                                    stacked: document.getElementById("allInv").checked,
                                    hideHover: true,
                                    yLabelFormat: formatY,
                                    hoverCallback: function (index, options, content, row) {
                                        return content + "<div class='morris-hover-point' style='color:orange'>Forventet:" + formatY(row.Forventet) + "</div>";
                                    }
                                });
                            }
                            else {
                                _Chart.options["ymax"]=result[0].Ymax;
                                _Chart.setData(result[0].data);
                            }

Chart.on('click', function (i, row) {alert(row.y)  })}</script>

我在我的应用程序中使用morris图表。我想在用户点击图表中的栏时执行一些操作。 点击事件在chrome,firefox,safari浏览器上工作正常,但我不知道为什么点击事件不能正常工作i.I'm卡住请帮帮我!

1 个答案:

答案 0 :(得分:0)

即使我遇到同样的问题。

在iPhone中,Hover被视为点击,因此通过设置HideHover: "always"可以禁用工具提示。