Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Onclick is called multiple times(once per each datapoint) instead one #1958

Closed
eugeneJava opened this issue Feb 9, 2017 · 3 comments
Closed

Comments

@eugeneJava
Copy link

I have a setup:

var chart = c3.generate({
"data":{
"onclick" : function(d) {
console.log(d.name);
} ,

  "order":null,
  "columns":[  
     [  
        "SENSUM_IND", null, 49.0
     ],
     [  
        "VASGEN", 100.0, null
     ]
  ],
  "type":"line",
  "colors":{  
     "SENSUM_IND":"#ef87fe",
     "VASGEN":"#b1222c"
  },
  "groups":[  
     [  
        "SENSUM_IND",
        "VASGEN"
     ]
  ]

},
"size":{
"width":null,
"height":null
},
"grid":{
"x":{
"lines":[
{
"value":"08-02-2017",
"class":"dashed"
},
{
"value":"09-02-2017",
"class":"dashed"
}
]
},
"y":{
"show":true
}
},
"axis":{
"x":{
"type":"category",
"categories":[
"08-02-2017",
"09-02-2017"
]
},
"rotated":false,
"y":{
"tick":{
"values":[
0.0,
10.0,
20.0,
30.0,
40.0,
50.0,
60.0,
70.0,
80.0,
90.0,
100.0
]
},
"padding":{
"top":0
}
}
},
"title":{
"text":""
},
"legend":{
"show":true
},
"tooltip":{
"show":true
},
"padding":{

}
});

and by clicking on each datapoint - onclick is called multiple times instead of one. Please help. It seems an issue. Thanks

@schwassj
Copy link

schwassj commented Mar 3, 2017

onclick seems to be driven by the x-value of the click, instead of the actual element clicked. I'm investigating this presently, but given #1965 it's unlikely any fix will be incorporated in the library. I'll post back if I find anything productive.

@panthony
Copy link
Contributor

Duplicate of #1658 ?

@panthony
Copy link
Contributor

closing as duplicate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants