Response title
This is preview!
I already found very good help some days ago
but I'm facing a new problem.
I try to replot a jqplot meter gauge when the browser window is resized. I could find some examples during my research that seem to work fine but as soon as I try it myself, I can't make it work.
Here is my code: My fiddle can be found here
$(document).ready(function(){
s1 = [72];
var plot0 = $.jqplot('chart0',[s1],{
seriesDefaults: {
renderer: $.jqplot.MeterGaugeRenderer,
rendererOptions: {
label: 'Your Score is <div class="score">' + s1 + '</div>', //Showing the value
labelPosition: 'bottom',
min: 0,
max: 100,
intervals:[30, 60, 80, 100],
intervalColors:['#cc6666', '#E7E658', '#93b75f', '#66cc66'],
ringColor: '#737373',
ringWidth: 0.00000000001,
background :"transparent",
intervalInnerRadius: 95,
hubRadius: 6,
showTicks: false,
needleThickness: 5,
showTickLabels: false,
}
}
});
$(window).resize(function() {
plot0.replot( { resetAxes: true } );
});
});
Maybe someone can see what I'm doing wrong? Any help is
highly appreciated! Getting started is so hard ...
You can find the working example which I try to rebuilt here.
Thank you!
<script> var plot0; $(window).resize(function(){ $('#chart0').html(''); plotGauge(); }); $(document).ready(function(){ plotGauge(); }); s1 = [22] function plotGauge(){ plot0 = $.jqplot('chart0',[s1],{ seriesDefaults: { renderer: $.jqplot.MeterGaugeRenderer, rendererOptions: { label: 'Your Score is <div class="score">' + s1 + '</div>', //Showing the value labelPosition: 'bottom', min: 0, max: 100, intervals:[30, 60, 80, 100], intervalColors:['#cc6666', '#E7E658', '#93b75f', '#66cc66'], ringColor: '#737373', ringWidth: 0.00000000001, background :"transparent", intervalInnerRadius: 95, hubRadius: 6, showTicks: false, needleThickness: 5, showTickLabels: false, } } }); } </script> test <div id="chart0"></div>
© 2013 jQuery Foundation
Sponsored by and others.