sanghavi7
sanghavi7

Reputation: 754

how to set/draw chart with minutes in jqplot line chart?

I want to draw chart dynamically.. depends of selection by user. below is screen shot for that.. enter image description here

in this I have doing something line this..

var plot2 = $.jqplot(div, mainArray, {
                            title:chartValue[1],
                            seriesDefaults: {
                                lineWidth:1,
                                markerOptions: { show:true, size:3 },
                                rendererOptions: {
                                    smooth: true
                                }
                            },
                            axesDefaults: {
                                labelOptions:{textColor:'#313233', fontSize:'11px',fontWeight:'Bold', fontFamily:'Arial'}
                            },
                            axes:{
                                xaxis:{
                                    renderer: $.jqplot.DateAxisRenderer,
                                    rendererOptions:{
                                        tickRenderer: $.jqplot.CanvasAxisTickRenderer,
                                        tickInset:0
                                    },
                                    //tickRenderer:$.jqplot.CanvasAxisTickRenderer,
                                    tickOptions:{
                                        autoscale:true,
                                        fontSize:'10px',
                                        fontFamily:'Arial',
                                        angle:-90,
                                        formatString: dFormat
                                    },
                                    //min: minDate,
                                    //max: maxDate,
                                    tickInterval:timeInterval
                                },
                                yaxis:{
                                    min: 0,
                                    max: maxV.length > 1 ? parseInt(maxV) + ((parseInt(maxV)/10)): parseInt(maxV)+2,
                                    tickOptions: {
                                        formatString: '%d',
                                        fontSize:'10px',
                                        fontFamily:'Arial',
                                        showGridline: true,
                                        showLabel: true
                                    },
                                    base: Math.E,
                                    forceTickAt0: true
                                }
                            },

                            legend: {
                                show: true,
                                labels: legendNames,
                                //placement: 'outsideGrid'
                                renderer:$.jqplot.EnhancedLegendRenderer,
                                location: 'ne',     // compass direction, nw, n, ne, e, se, s, sw, w.
                                xoffset: 10,        // pixel offset of the legend box from the x (or x2) axis.
                                yoffset: 10        // pixel offset of the legend box from the y (or y2) axis.
                            },

                            cursor:{
                                show:true,
                                style:'auto',
                                followMouse:true,
                                zoom:true,
                                looseZoom:true,
                                showTooltip:false
                            }

                        });

in this starting of time from 12.00. but i want it near to data. how that`s possible?

Note:

mainArray = data
dFormat = string format for date time

Upvotes: 1

Views: 748

Answers (1)

joshuahedlund
joshuahedlund

Reputation: 1782

I think you just need to set the min property that you have commented out under xaxis.

Depending on how your mainArray is formatted you may be able to get the first date value with mainArray[0][0][0] or mainArray[0][0]. Or, you may have to set/pass the variable minDate.

Upvotes: 1

Related Questions