- Screen name: Marei Gürtner
Marei Gürtner's Profile
2 Posts
5 Responses
0
Followers
Show:
- Expanded view
- List view
Private Message
- 02-Feb-2016 11:35 AM
- Forum: Getting Started
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!
- 01-Feb-2016 06:26 AM
- Forum: Getting Started
I'm facing a problem loading a simple external file with just one value into my jqplot meter gauge.
Here is my working fiddle with hardcoded data: https://jsfiddle.net/enqjh8m3/1/
I read through the jqplot documentation and looked at some examples but I just can't make it work. It's the first time I use jqplot and I'm not very experienced working with js. But havent we all started somewhere?
Here is my approach to load a file called keyscore.txt, which just contains
[66]
My not working code:
<script type="text/javascript"> var ajaxJqPlot = { settings : { data_url : "keyscore.txt", element_id : "chart0" }, plot : function(settings){ t = this; $.extend(t.settings, settings); $.ajax({ async : false, url : t.settings.data_url, dataType :"json", success : t.renderer }); }, renderer : function(res){ t = this; $.jqplot('chart0', res.data, { seriesDefaults: { renderer: $.jqplot.MeterGaugeRenderer, rendererOptions: { label: 'Keyword Health Score', labelPosition: 'bottom', min: 0, max: 100, intervals:[30, 60, 80, 100], intervalColors:['#cc6666', '#E7E658', '#93b75f', '#66cc66'], // ringColor: '#363636', // tickColor: '#363636', ringWidth: 0.5, padding: 30, background :"#ededed", ticks: [0, 15,50,75,100], intervalInnerRadius: 50, intervalOuterRadius: 120, hubRadius: 10, // needleThickness: 5, ); } }; $(document).ready(function(){ ajaxJqPlot.plot(); });
A copy of keyscore.txt can be found here
Maybe someone can help me out and look at my code or point me into the right direction? Any help is very appreciated!
- «Prev
- Next »
Moderate user : Marei Gürtner