Browse Source

Fix stacking line with 0 value - #316

pull/329/head
Masayuki Tanaka 11 years ago
parent
commit
a7cc082d27
  1. 2
      c3.js
  2. 2
      c3.min.js
  3. 12
      htdocs/samples/chart_area_spline_stacked.html
  4. 12
      htdocs/samples/chart_area_stacked.html
  5. 2
      htdocs/samples/chart_bar_stacked.html

2
c3.js

@ -2103,7 +2103,7 @@
y0 = scale(0), offset = y0;
targets.forEach(function (t) {
if (t.id === d.id || indices[t.id] !== indices[d.id]) { return; }
if (targetIds.indexOf(t.id) < targetIds.indexOf(d.id) && t.values[i].value * d.value > 0) {
if (targetIds.indexOf(t.id) < targetIds.indexOf(d.id) && t.values[i].value * d.value >= 0) {
offset += scale(t.values[i].value) - y0;
}
});

2
c3.min.js vendored

File diff suppressed because one or more lines are too long

12
htdocs/samples/chart_area_spline_stacked.html

@ -15,8 +15,8 @@
bindto: '#chart1',
data: {
columns: [
['data1', 300, 350, 300, 0, 0, 0],
['data2', 130, 100, 140, 200, 150, 50]
['data1', 300, 350, 300, 0, 0, 100],
['data2', 130, 0, 140, 200, 0, 50],
],
type: 'area-spline',
groups: [['data1', 'data2']],
@ -27,8 +27,8 @@
bindto: '#chart2',
data: {
columns: [
['data1', -300, -350, -300, 0, 0, 0],
['data2', -130, -100, -140, -200, -150, -50]
['data1', -300, -350, -300, 0, 0, -100],
['data2', -130, 0, -140, -200, 0, -50]
],
type: 'area-spline',
groups: [['data1', 'data2']],
@ -39,8 +39,8 @@
bindto: '#chart3',
data: {
columns: [
['data1', -300, 350, -300, 0, 0, 0],
['data2', -130, -100, 140, -200, 150, -50]
['data1', -300, 350, -300, 0, 0, 100],
['data2', -130, 0, 140, -200, 150, -50]
],
type: 'area-spline',
groups: [['data1', 'data2']],

12
htdocs/samples/chart_area_stacked.html

@ -15,8 +15,8 @@
bindto: '#chart1',
data: {
columns: [
['data1', 300, 350, 300, 0, 0, 0],
['data2', 130, 100, 140, 200, 150, 50]
['data1', 300, 350, 300, 0, 0, 100],
['data2', 130, 0, 140, 200, 0, 50],
],
type: 'area',
groups: [['data1', 'data2']],
@ -27,8 +27,8 @@
bindto: '#chart2',
data: {
columns: [
['data1', -300, -350, -300, 0, 0, 0],
['data2', -130, -100, -140, -200, -150, -50]
['data1', -300, -350, -300, 0, 0, -100],
['data2', -130, 0, -140, -200, 0, -50]
],
type: 'area',
groups: [['data1', 'data2']],
@ -39,8 +39,8 @@
bindto: '#chart3',
data: {
columns: [
['data1', -300, 350, -300, 0, 0, 0],
['data2', -130, -100, 140, -200, 150, -50]
['data1', -300, 350, -300, 0, 0, 100],
['data2', -130, 0, 140, -200, 150, -50]
],
type: 'area',
groups: [['data1', 'data2']],

2
htdocs/samples/chart_bar_stacked.html

@ -13,7 +13,7 @@
columns: [
['data1', 30, 200, 200, 400, 150, -250],
['data2', 130, -100, 100, 200, 150, 50],
['data3', 230, -200, 200, 300, 250, 250]
['data3', 230, -200, 200, 0, 250, 250]
],
type: 'bar',
groups: [

Loading…
Cancel
Save