javascript - Jqplot canvasAxisTickRenderer breaking plot -
i'm trying add canvasaxistickrenderer ticks can rotated adding causing plot break , nothing gets displayed.
i have added js
file application.js
file.
//= require plugins/jquery.jqplot //= require plugins/jqplot.cursor.min //= require plugins/jqplot.dateaxisrenderer.min //= require plugins/jqplot.highlighter.min //= require plugins/jqplot.donutrenderer //= require plugins/jquery.cookie.js //= require plugins/jqplot.categoryaxisrenderer //= require plugins/jqplot.barrenderer //= require plugins/jqplot.canvasaxistickrenderer
can see wrong code causes error:
uncaught typeerror: undefined not function$.jqplot.canvasaxistickrenderer @ jqplot.canvasaxistickrenderer.js?body=1:138$.jqplot.categoryaxisrenderer.createticks @ jqplot.categoryaxisrenderer.js?body=1:149$.jqplot.categoryaxisrenderer.draw @ jqplot.categoryaxisrenderer.js?body=1:312axis.draw @ jquery.jqplot.js?body=1:739draw @ jquery.jqplot.js?body=1:2978$.jqplot @ jquery.jqplot.js?body=1:242(anonymous function) @ poll_questions:419jquery.callbacks.fire @ jquery.js?body=1:3065jquery.callbacks.self.firewith @ jquery.js?body=1:3177jquery.extend.ready @ jquery.js?body=1:434completed @ jquery.js?body=1:105
the code:
$(document).ready(function(){ var plot_<%= poll.id %> = $.jqplot('poll-graph_<%= poll.id %>', databar_<%= poll.id %>, { height:200, seriesdefaults:{ renderer:$.jqplot.barrenderer, rendereroptions: {filltozero: true, barwidth: 50, highlightmouseover: false, shadow: false } }, grid: { shadow:false, borderwidth: 0, background: '#ffffff', }, highlighter: { show: true, useaxesformatters: false, tooltiplocation: 'n', tooltipcontenteditor: function (str, seriesindex, pointindex, plot) { // = portfoliodata_<%#= @portfolio.id %>[pointindex][0]; = ticks_<%= poll.id %>[pointindex]; return a; } }, axes: { // use category axis on x axis , use our custom ticks. xaxis: { renderer: $.jqplot.categoryaxisrenderer, ticks: ticks_<%= poll.id %>, tickrenderer: $.jqplot.canvasaxistickrenderer, tickoptions: { showlabel: true } }, // pad y axis little bars can close to, // not touch, grid boundaries. 1.2 default padding. yaxis: { tickoptions: { show: false } } } }); $(window).resize(function() { plot_<%= poll.id %>.replot( { resetaxes: true } ); }); });
here data:
var ticks_3 = ["equities","bonds","property","multi-asset","income","other"]; var polldata_3 = [5,1,1,1,1,1]; var databar_3 = [polldata_3];
Comments
Post a Comment