I am a beginner in html and javascript so your help will be much appreciated.
I am creating a page that accepts values x and y from a form and enters it into a graph.
The graph is working perfectly on the same web page but i would like to have the graph in an entirely different page after I click the submit button. How can i carry forward these variables to a different page and display the same graph? (I would like to avoid JQuery, php etc altogether as this is for a school project)
Here's my code:
function someFunction(){
var xScore = parseFloat(x)
var yScore = parseFloat(y)
google.charts.load('current', {'packages':['corechart']});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['x', 'y'],
[ xScore , yScore],
]);
var options = {
title: 'Sample Graph',
hAxis: {title: 'x value', minValue: 1, maxValue: 9},
vAxis: {title: 'y value', minValue: 1, maxValue: 9},
legend: 'none'
};
var chart = new google.visualization.ScatterChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
This chart loads when i place following the div in the body.
<div id="chart_div" style="width: 900px; height: 900px;">
I would like to place this div in the body of another html page but would like to carry forward the x and y values generated on this web page (they are generated when the form is submitted).