I have a event who create a graph in C3.js inside a div. And When I call my function who create my graph I see my console.log() and my graph is not create.
Template.home.events({
'click .zone': function(event){
//alert(event.target.id);
var mydiv = "#" + $(event.target).attr("id");
console.log(name);
$("mydiv").remove();
$("mydiv").on(create());
}
});
function create(){
console.log("inside create");
var chart = c3.generate({
bindto: '#graphItem0_2',
data: {
columns: [
['data1', 30, 200, 100, 400, 150, 250],
['data2', 50, 20, 10, 40, 15, 25]
],
empty: {
label: {
text: "No Data"
}
}
}
});
console.log("End create");
}
my template :
<template name="graphDisplayer">
<div class="zone">
<svg id="graphItemt0_2" with="300" height="300"></svg>
</div>
</template>
You have quoted "mydiv" but it is a variable:
Should be