简体   繁体   中英

Jqplot graph data doesn't work fine

I'm new in Jqplot, and I have a ploblem with IE11. I'm trying to display a graph with "month" on xaxis. this is my code.

var line1=[["1", 4],["2", 4],["3", 4], ["4", 6.5], ["5", 5.7], ["6", 9]];
var plot1 = $.jqplot('chart', [line1], {
    title:'Rotated Axis Text',
    axesDefaults: {
            labelRenderer: $.jqplot.CanvasAxisLabelRenderer
    },
    axes:{
        xaxis:{
                label:"test axes des abs",
                pad: 0,
                renderer:$.jqplot.DateAxisRenderer, 
                rendererOptions:{
                        tickRenderer:$.jqplot.CanvasAxisTickRenderer
                },
                tickOptions:{ 
                        fontSize:'10pt', 
                        fontFamily:'Tahoma', 
                        angle:-40,
                        formatString:'%B'
                }
        },

        yaxis:{
            label:'Cosine',
        }                   
    },
   legend: {
            renderer: $.jqplot.EnhancedLegendRenderer,
            show: true,
            showLabels: true,
            location: 'ne',
            placement: 'outside',
            fontSize: '11px',
            fontFamily: ["Lucida Grande","Lucida Sans Unicode","Arial",],
            rendererOptions: {
                 seriesToggle: 'normal'
            }
    },
   series:[{"label":"test des lignes"}],
   cursor:{
            zoom:true,
            looseZoom: true
        }
});

where "chart" is an identifier off the graph container. this works in chrome 当我使用铬

But when i use IE only one month is displayed. 在此处输入图片说明

How can fix it ? Thanks in advance.

You should provide a less dubious string that can be parsed as date for the x-axis value:

var line1=[["2016-01-01", 4], ["2016-02-01", 4], ["2016-03-01", 4], ["2016-04-01", 6.5], ["2016-05-01", 5.7], ["2016-06-01", 9]];

If in doubt, provide an actual Date object instead of a string.

Internally, the renderer will call new $.jsDate( your-x-axis-value ) , which seemingly yields different results in your browsers for the values you provided.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM