Hi Guys,
I am new to the forum and new to javascript, just had a few questions.
I am going to create a .htm file that will be used for personal use. The project is to create .js graphs using jquery.
My question: I would like to create a form that will allow me to enter the following information:
1.Title of the graph
2.Subtitle
3.Y Axis label
4.X Axis label
5. Number of Bars/Lines/Pie slices needed
6. Name of each Bars/Lines/Pie slices needed
7. Value of each Bars/Lines/Pie slices
Depending on this data, i want my .js file to fetch data from the form, and input it in the graph. I know how to have the data in the .js file, just don’t know the syntax to fetch it from the form. The graph example is below, with pre-filled data. I have highlighted in pink ONE part of the graph, exemplifying the data i would need fetched from the form.
Thanks in advance, and apologize for my newbie skills!
$(function () {
var chart;
$(document).ready(function() {
chart = new Highcharts.Chart({
chart: {
renderTo: ‘container’,
type: ‘bar’
},
title: {
text: ‘Historic World Population by Region’
},
subtitle: {
text: ‘Source: Wikipedia.org’
},
xAxis: {
categories: [‘[COLOR=”Magenta”]Africa’, ‘America’, ‘Asia’, ‘Europe’, ‘Oceania
title: {
text: null
}
},
yAxis: {
min: 0,
title: {
text: ‘Population (millions)’,
align: ‘high’
}
},
tooltip: {
formatter: function() {
return ”+
this.series.name +’: ‘+ this.y +’ millions’;
}
},
plotOptions: {
bar: {
dataLabels: {
enabled: true
}
}
},
legend: {
layout: ‘vertical’,
align: ‘right’,
verticalAlign: ‘top’,
x: -100,
y: 100,
floating: true,
borderWidth: 1,
backgroundColor: ‘#FFFFFF’,
shadow: true
},
credits: {
enabled: false
},
series: [{
name: ‘Year 1800’,
data: [107, 31, 635, 203, 2]
}, {
name: ‘Year 1900’,
data: [133, 156, 947, 408, 6]
}, {
name: ‘Year 2008’,
data: [973, 914, 4054, 732, 34]
}]
});
});
});
</script>
</head>
<body>
<script src=”../../js/highcharts.js”></script>
<script src=”../../js/modules/exporting.js”></script>
<div id=”container” style=”min-width: 400px; height: 400px; margin: 0 auto”></div>
</body>
</html>