Browse Source

Added classname as a config parameter which will set svg class

pull/1289/head
Daniele Piccone 10 years ago
parent
commit
3b18d5f463
  1. 5
      c3.js
  2. 1
      src/config.js
  3. 4
      src/core.js

5
c3.js

@ -257,6 +257,10 @@
.on('mouseenter', function () { return config.onmouseover.call($$); }) .on('mouseenter', function () { return config.onmouseover.call($$); })
.on('mouseleave', function () { return config.onmouseout.call($$); }); .on('mouseleave', function () { return config.onmouseout.call($$); });
if ($$.config.classname) {
$$.svg.attr('class', $$.config.classname);
}
// Define defs // Define defs
defs = $$.svg.append("defs"); defs = $$.svg.append("defs");
$$.clipChart = $$.appendClip(defs, $$.clipId); $$.clipChart = $$.appendClip(defs, $$.clipId);
@ -1064,6 +1068,7 @@
c3_chart_internal_fn.getDefaultConfig = function () { c3_chart_internal_fn.getDefaultConfig = function () {
var config = { var config = {
bindto: '#chart', bindto: '#chart',
classname: undefined,
size_width: undefined, size_width: undefined,
size_height: undefined, size_height: undefined,
padding_left: undefined, padding_left: undefined,

1
src/config.js

@ -1,6 +1,7 @@
c3_chart_internal_fn.getDefaultConfig = function () { c3_chart_internal_fn.getDefaultConfig = function () {
var config = { var config = {
bindto: '#chart', bindto: '#chart',
classname: undefined,
size_width: undefined, size_width: undefined,
size_height: undefined, size_height: undefined,
padding_left: undefined, padding_left: undefined,

4
src/core.js

@ -252,6 +252,10 @@ c3_chart_internal_fn.initWithData = function (data) {
.on('mouseenter', function () { return config.onmouseover.call($$); }) .on('mouseenter', function () { return config.onmouseover.call($$); })
.on('mouseleave', function () { return config.onmouseout.call($$); }); .on('mouseleave', function () { return config.onmouseout.call($$); });
if ($$.config.classname) {
$$.svg.attr('class', $$.config.classname);
}
// Define defs // Define defs
defs = $$.svg.append("defs"); defs = $$.svg.append("defs");
$$.clipChart = $$.appendClip(defs, $$.clipId); $$.clipChart = $$.appendClip(defs, $$.clipId);

Loading…
Cancel
Save