I am creating a project in React
and I am trying to open a canvasjs
graph in another window on a button click. Below is the code to the loadData.js file that when the program is ran I will click on the button to open a separate window containing the graph. The issue that I am running into is that the graph is contained in another file called multiSeriesChart.js and I am not quite sure how to call it inside of the button. Is there something in React that I can use to do this? the window.open()
function does not seem to be working. Thank you!
openNewWindow = () => {
const newWindow = window.open();
newWindow.document.write(<MultiSeriesChart dataFromParent = {this.state} parentCallback/>);
}
render() {
return (
<div>
<title>Program Controller</title>
<h1>Program Controls: </h1>
<button onClick={this.pressedLoad}>Load Data</button>
<button id="multiSeriesChart" onClick={this.openNewWindow}>Open Multi-Series Graph</button>
</div>
);
};
};