jqPlot points not correct when numberTicks set

醉酒当歌 提交于 2019-12-24 03:43:27

问题


I'm trying to limit the number of ticks on a dynamic jqplot I'm setting up. Unfortunately, when I do it, the points do not look accurate. Here's what it looks like:

As you can see, the point on 10/05/12, for example, is not on it's correct axis. I realize that now these points are estimated, but the points must look accurate on the graph -- especially when hovering over the points gives you their correct date and y-axis value.

Here's my code for this intilization, if that helps:

var datepickerBegin = $("#datepicker_start").datepicker({dateFormat: "dd/mm/yyyy"}).val();
                                var datepickerEnd = $("#datepicker_to").datepicker({dateFormat: "dd/mm/yyyy"}).val();

                                var startDiff = $("#datepicker_start").datepicker("getDate");
                                var endDiff = $("#datepicker_to").datepicker("getDate");
                                alert(startDiff)
                                alert(endDiff)

                                // Check if dates are more than a week apart
                                    if(endDiff - startDiff >= 15 * 86400 * 1000) {
                                    var plot2 = $.jqplot('chart2', jsonurl,{
                                        title: "Storage Space",
                                        dataRenderer: ajaxDataRenderer,
                                        dataRendererOptions: {unusedOptionalUrl: jsonurl},
                                        axes: {
                                            xaxis: {
                                                'numberTicks' : 15,
                                                min: datepickerBegin,
                                                max: datepickerEnd,
                                                renderer:$.jqplot.DateAxisRenderer,
                                                rendererOptions:{tickRenderer:$.jqplot.CanvasAxisTickRenderer},
                                                tickInterval: '1 day',
                                                tickOptions:{formatString:'%#m/%#d/%Y'

                                                }

                                            },
                                            yaxis: {
                                                label: "MB",
                                                tickOptions:{formatString:'%d '},
                                                min: 0
                                            }

                                        },
                                        highlighter: {
                                            show: true,
                                            sizeAdjust: 7.5
                                        }
                                    });
                                    // Somehow fix the line?
                                    plot2.redraw({});

                                } 

Anyone out there have a fix for this? Thanks!

来源:https://stackoverflow.com/questions/12822514/jqplot-points-not-correct-when-numberticks-set

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!