Browse Source

Fix conflict

pull/1443/head
Masayuki Tanaka 9 years ago
parent
commit
89b2d2d942
  1. 5
      c3.js
  2. 4
      c3.min.js
  3. 8
      spec/core-spec.js
  4. 1
      src/config.js
  5. 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.svg_classname) {
$$.svg.attr('class', $$.config.svg_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',
svg_classname: undefined,
size_width: undefined, size_width: undefined,
size_height: undefined, size_height: undefined,
padding_left: undefined, padding_left: undefined,

4
c3.min.js vendored

File diff suppressed because one or more lines are too long

8
spec/core-spec.js

@ -4,6 +4,9 @@ describe('c3 chart', function () {
var chart; var chart;
var args = { var args = {
svg: {
classname: 'customclass'
},
data: { data: {
columns: [ columns: [
['data1', 30, 200, 100, 400, 150, 250], ['data1', 30, 200, 100, 400, 150, 250],
@ -34,6 +37,11 @@ describe('c3 chart', function () {
expect(svg).not.toBeNull(); expect(svg).not.toBeNull();
}); });
it('should be created with a custom class', function () {
var svg = d3.select('#chart svg');
expect(svg.attr('class')).not.toBeNull();
expect(svg.attr('class')).toBe('customclass');
});
}); });
describe('size', function () { describe('size', function () {

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',
svg_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.svg_classname) {
$$.svg.attr('class', $$.config.svg_classname);
}
// Define defs // Define defs
defs = $$.svg.append("defs"); defs = $$.svg.append("defs");
$$.clipChart = $$.appendClip(defs, $$.clipId); $$.clipChart = $$.appendClip(defs, $$.clipId);

Loading…
Cancel
Save