Reputation: 4982
jQuery(document).ready(function() {
var firstv=10;
var secondv=20;
var thirdv=70;
var name1=ram;
var name2=kumar;
var name3=manju;
var data = [ [name1, firstv],[name2, secondv], [name3, thirdv]];
var plot1 = jQuery.jqplot('chart', [data],
{
grid: {
shadow: false,
background: '#FFFFFF',
},
seriesDefaults: {
// Make this a pie chart.
renderer: jQuery.jqplot.PieRenderer,
rendererOptions: {
showDataLabels: true,
padding: 20,
startAngle: 270
}
},
legend: {
show: true,
location: 'e',
fontSize: 11,
marginTop: 10,
}
});
});
if i assign values to var , it is not fetching it?
Upvotes: 0
Views: 294
Reputation: 33661
Do you mean to store a string instead?
var secondv=20;
var thirdv=70;
var name1=ram; // var name1='ram';
var name2=kumar; // var name2='kumar';
var name3=manju; // var name3='manju';
If not where are you getting those variables from?
and if you are just using those values once. You can directly assign them in data
var data = [
["ram", 10],
["kumar", 20],
["manju", 70]
];
Upvotes: 2
Reputation: 8109
Check the error console:
Uncaught ReferenceError: ram is not defined
Change your assignment of names to quoted names:
var name1="ram";
var name2="kumar";
var name3="manju";
Upvotes: 1