1

I have an alchemy graph displayed.

new Alchemy(config);

How can I change the config.dataSource and then redisplay the graph with the new data?

1 Answers1

0

You could create an new configuration and then reload it in javascript. Something like this:

<script type="javascript">
var config = {
dataSource: "data/data.json", 
...
...
}

var newConfig = {
    dataSource: "data/new_data.json", 
    ...
    ...    
}

function changeData(){
    alchemy = new Alchemy(newconfig);
}
</script>

<body>
    <button onclick="changeData()">Click me</button> 
</body>
Piskr
  • 101
  • 1
  • 6