How to add a line inside a D3 chart










0















I have developed a D3 chart using D3 version 3. In there I need to add a separator line in the chart to separate columns. The chart represents months and that line is used to separate the months of two years. Is there a possible way to add this kind of a line into a chart. Always the separator position is not fixed, it may be here and there depending on where January is marked in the chart. The following picture shows an expected behavior. And sample code is also given, Can someone give a solution for this problem



Fiddle : https://jsfiddle.net/yasirunilan/921fsugh/4/



enter image description here



const sample = [
month: 'Sep',
value: 78.9,
color: '#000000',
date: '30/09/17'
,

month: 'Oct',
value: 75.1,
color: '#00a2ee',
date: '31/10/17'
,

month: 'Nov',
value: 68.0,
color: '#fbcb39',
date: '30/11/17'
,

month: 'Dec',
value: 67.0,
color: '#007bc8',
date: '31/12/17'
,

month: 'Jan',
value: 65.6,
color: '#65cedb',
date: '31/01/18'
,

month: 'Feb',
value: 65.1,
color: '#ff6e52',
date: '28/02/18'
,

month: 'Mar',
value: 61.9,
color: '#f9de3f',
date: '31/03/18'
,

month: 'Apr',
value: 60.4,
color: '#5d2f8e',
date: '30/04/18'
,

month: 'May',
value: 59.6,
color: '#008fc9',
date: '31/05/18'
,

month: 'Jun',
value: 59.6,
color: '#507dca',
date: '30/06/18'
,

month: 'Jul',
value: 80.6,
color: '#507dca',
date: '31/07/18'
,

month: 'Aug',
value: 45.6,
color: '#507dca',
date: '31/08/18'
,

month: 'Sep ',
value: 78.6,
color: '#507dca',
date: '30/09/18'

];

const svg = d3.select('svg');
const svgContainer = d3.select('#container');

const margin = 80;
const width = 1000 - 2 * margin;
const height = 600 - 2 * margin;

const chart = svg.append('g')
.attr('transform', `translate($margin, $margin)`);

const xScale = d3.scale.ordinal()
.rangeRoundBands([0, width], 0.4)
.domain(sample.map((s) => s.month))

const yScale = d3.scale.linear()
.range([height, 0])
.domain([0, 100]);

// vertical grid lines
// const makeXLines = () => d3.axisBottom()
// .scale(xScale)

const makeYLines = () => d3.svg.axis().scale(yScale).orient("left")


chart.append('g')
.attr('transform', `translate(0, $height)`)
.call(d3.svg.axis().scale(xScale).orient("bottom").tickSize(1));

chart.append('g')
.call(d3.svg.axis().scale(yScale).orient("left").tickFormat(d3.format("d")).tickSize(1));

// vertical grid lines
// chart.append('g')
// .attr('class', 'grid')
// .attr('transform', `translate(0, $height)`)
// .call(makeXLines()
// .tickSize(-height, 0, 0)
// .tickFormat('')
// )

chart.append('g')
.attr('class', 'grid')
.call(makeYLines()
.tickSize(-width, 0, 0)
.tickFormat('')
)

const barGroups = chart.selectAll()
.data(sample)
.enter()
.append('g')

barGroups
.append('rect')
.attr('class', 'bar')
.attr('x', (g) => xScale(g.month))
.attr('y', (g) => yScale(g.value))
.attr('height', (g) => height - yScale(g.value))
.attr('width', xScale.rangeBand())
.on('mouseenter', function(actual, i)
d3.selectAll('.value')
.attr('opacity', 0)

d3.select(this)
.transition()
.duration(300)
.attr('opacity', 0.6)
.attr('x', (a) => xScale(a.month) - 5)
.attr('width', xScale.rangeBand() + 10)

const y = yScale(actual.value)

line = chart.append('line')
.attr('id', 'limit')
.attr('x1', 0)
.attr('y1', y)
.attr('x2', width)
.attr('y2', y)

barGroups.append('text')
.attr('class', 'divergence')
.attr('x', (a) => xScale(a.month) + xScale.bandwidth() / 2)
.attr('y', (a) => yScale(a.value) + 30)
.attr('fill', 'white')
.attr('text-anchor', 'middle')
.text((a, idx) =>
const divergence = (a.value - actual.value).toFixed(1)

let text = ''
if (divergence > 0) text += '+'
text += `$divergence%`

return idx !== i ? text : '';
)

)
.on('mouseleave', function()
d3.selectAll('.value')
.attr('opacity', 1)

d3.select(this)
.transition()
.duration(300)
.attr('opacity', 1)
.attr('x', (a) => xScale(a.month))
.attr('width', xScale.rangeBand())

chart.selectAll('#limit').remove()
chart.selectAll('.divergence').remove()
)

barGroups
.append('text')
.attr('class', 'value')
.attr('x', (a) => xScale(a.month) + xScale.rangeBand() / 2)
.attr('y', (a) => yScale(a.value) + 30)
.attr('text-anchor', 'middle')
.text((a) => `$a.value%`)

svg
.append('text')
.attr('class', 'label')
.attr('x', -(height / 2) - margin)
.attr('y', margin / 2.4)
.attr('transform', 'rotate(-90)')
.attr('text-anchor', 'middle')
.text('Love meter (%)')

svg.append('text')
.attr('class', 'label')
.attr('x', width / 2 + margin)
.attr('y', height + margin * 1.7)
.attr('text-anchor', 'middle')
.text('Months')

svg.append('text')
.attr('class', 'title')
.attr('x', width / 2 + margin)
.attr('y', 40)
.attr('text-anchor', 'middle')
.text('Most loved programming languages in 2018')

svg.append('text')
.attr('class', 'source')
.attr('x', width - margin / 2)
.attr('y', height + margin * 1.7)
.attr('text-anchor', 'start')
.text('Source: Stack Overflow, 2018')









share|improve this question
























  • Is this => stackoverflow.com/questions/52752764/… a duplicate of this ticket? Just curious to know.

    – David R
    Nov 16 '18 at 6:34











  • Quite similar, the solutions given in that question is not valid for D3v3 that's why I raised a separate question with D3 V3 code.

    – Yasiru Nilan
    Nov 16 '18 at 6:37











  • Okay.. Got it!.

    – David R
    Nov 16 '18 at 6:37











  • @DavidR but it is duplicate of stackoverflow.com/q/53316144/9938317

    – rioV8
    Nov 16 '18 at 6:45






  • 1





    Possible duplicate of How to add a separator in D3 bar chart D3V3

    – rioV8
    Nov 16 '18 at 6:45















0















I have developed a D3 chart using D3 version 3. In there I need to add a separator line in the chart to separate columns. The chart represents months and that line is used to separate the months of two years. Is there a possible way to add this kind of a line into a chart. Always the separator position is not fixed, it may be here and there depending on where January is marked in the chart. The following picture shows an expected behavior. And sample code is also given, Can someone give a solution for this problem



Fiddle : https://jsfiddle.net/yasirunilan/921fsugh/4/



enter image description here



const sample = [
month: 'Sep',
value: 78.9,
color: '#000000',
date: '30/09/17'
,

month: 'Oct',
value: 75.1,
color: '#00a2ee',
date: '31/10/17'
,

month: 'Nov',
value: 68.0,
color: '#fbcb39',
date: '30/11/17'
,

month: 'Dec',
value: 67.0,
color: '#007bc8',
date: '31/12/17'
,

month: 'Jan',
value: 65.6,
color: '#65cedb',
date: '31/01/18'
,

month: 'Feb',
value: 65.1,
color: '#ff6e52',
date: '28/02/18'
,

month: 'Mar',
value: 61.9,
color: '#f9de3f',
date: '31/03/18'
,

month: 'Apr',
value: 60.4,
color: '#5d2f8e',
date: '30/04/18'
,

month: 'May',
value: 59.6,
color: '#008fc9',
date: '31/05/18'
,

month: 'Jun',
value: 59.6,
color: '#507dca',
date: '30/06/18'
,

month: 'Jul',
value: 80.6,
color: '#507dca',
date: '31/07/18'
,

month: 'Aug',
value: 45.6,
color: '#507dca',
date: '31/08/18'
,

month: 'Sep ',
value: 78.6,
color: '#507dca',
date: '30/09/18'

];

const svg = d3.select('svg');
const svgContainer = d3.select('#container');

const margin = 80;
const width = 1000 - 2 * margin;
const height = 600 - 2 * margin;

const chart = svg.append('g')
.attr('transform', `translate($margin, $margin)`);

const xScale = d3.scale.ordinal()
.rangeRoundBands([0, width], 0.4)
.domain(sample.map((s) => s.month))

const yScale = d3.scale.linear()
.range([height, 0])
.domain([0, 100]);

// vertical grid lines
// const makeXLines = () => d3.axisBottom()
// .scale(xScale)

const makeYLines = () => d3.svg.axis().scale(yScale).orient("left")


chart.append('g')
.attr('transform', `translate(0, $height)`)
.call(d3.svg.axis().scale(xScale).orient("bottom").tickSize(1));

chart.append('g')
.call(d3.svg.axis().scale(yScale).orient("left").tickFormat(d3.format("d")).tickSize(1));

// vertical grid lines
// chart.append('g')
// .attr('class', 'grid')
// .attr('transform', `translate(0, $height)`)
// .call(makeXLines()
// .tickSize(-height, 0, 0)
// .tickFormat('')
// )

chart.append('g')
.attr('class', 'grid')
.call(makeYLines()
.tickSize(-width, 0, 0)
.tickFormat('')
)

const barGroups = chart.selectAll()
.data(sample)
.enter()
.append('g')

barGroups
.append('rect')
.attr('class', 'bar')
.attr('x', (g) => xScale(g.month))
.attr('y', (g) => yScale(g.value))
.attr('height', (g) => height - yScale(g.value))
.attr('width', xScale.rangeBand())
.on('mouseenter', function(actual, i)
d3.selectAll('.value')
.attr('opacity', 0)

d3.select(this)
.transition()
.duration(300)
.attr('opacity', 0.6)
.attr('x', (a) => xScale(a.month) - 5)
.attr('width', xScale.rangeBand() + 10)

const y = yScale(actual.value)

line = chart.append('line')
.attr('id', 'limit')
.attr('x1', 0)
.attr('y1', y)
.attr('x2', width)
.attr('y2', y)

barGroups.append('text')
.attr('class', 'divergence')
.attr('x', (a) => xScale(a.month) + xScale.bandwidth() / 2)
.attr('y', (a) => yScale(a.value) + 30)
.attr('fill', 'white')
.attr('text-anchor', 'middle')
.text((a, idx) =>
const divergence = (a.value - actual.value).toFixed(1)

let text = ''
if (divergence > 0) text += '+'
text += `$divergence%`

return idx !== i ? text : '';
)

)
.on('mouseleave', function()
d3.selectAll('.value')
.attr('opacity', 1)

d3.select(this)
.transition()
.duration(300)
.attr('opacity', 1)
.attr('x', (a) => xScale(a.month))
.attr('width', xScale.rangeBand())

chart.selectAll('#limit').remove()
chart.selectAll('.divergence').remove()
)

barGroups
.append('text')
.attr('class', 'value')
.attr('x', (a) => xScale(a.month) + xScale.rangeBand() / 2)
.attr('y', (a) => yScale(a.value) + 30)
.attr('text-anchor', 'middle')
.text((a) => `$a.value%`)

svg
.append('text')
.attr('class', 'label')
.attr('x', -(height / 2) - margin)
.attr('y', margin / 2.4)
.attr('transform', 'rotate(-90)')
.attr('text-anchor', 'middle')
.text('Love meter (%)')

svg.append('text')
.attr('class', 'label')
.attr('x', width / 2 + margin)
.attr('y', height + margin * 1.7)
.attr('text-anchor', 'middle')
.text('Months')

svg.append('text')
.attr('class', 'title')
.attr('x', width / 2 + margin)
.attr('y', 40)
.attr('text-anchor', 'middle')
.text('Most loved programming languages in 2018')

svg.append('text')
.attr('class', 'source')
.attr('x', width - margin / 2)
.attr('y', height + margin * 1.7)
.attr('text-anchor', 'start')
.text('Source: Stack Overflow, 2018')









share|improve this question
























  • Is this => stackoverflow.com/questions/52752764/… a duplicate of this ticket? Just curious to know.

    – David R
    Nov 16 '18 at 6:34











  • Quite similar, the solutions given in that question is not valid for D3v3 that's why I raised a separate question with D3 V3 code.

    – Yasiru Nilan
    Nov 16 '18 at 6:37











  • Okay.. Got it!.

    – David R
    Nov 16 '18 at 6:37











  • @DavidR but it is duplicate of stackoverflow.com/q/53316144/9938317

    – rioV8
    Nov 16 '18 at 6:45






  • 1





    Possible duplicate of How to add a separator in D3 bar chart D3V3

    – rioV8
    Nov 16 '18 at 6:45













0












0








0








I have developed a D3 chart using D3 version 3. In there I need to add a separator line in the chart to separate columns. The chart represents months and that line is used to separate the months of two years. Is there a possible way to add this kind of a line into a chart. Always the separator position is not fixed, it may be here and there depending on where January is marked in the chart. The following picture shows an expected behavior. And sample code is also given, Can someone give a solution for this problem



Fiddle : https://jsfiddle.net/yasirunilan/921fsugh/4/



enter image description here



const sample = [
month: 'Sep',
value: 78.9,
color: '#000000',
date: '30/09/17'
,

month: 'Oct',
value: 75.1,
color: '#00a2ee',
date: '31/10/17'
,

month: 'Nov',
value: 68.0,
color: '#fbcb39',
date: '30/11/17'
,

month: 'Dec',
value: 67.0,
color: '#007bc8',
date: '31/12/17'
,

month: 'Jan',
value: 65.6,
color: '#65cedb',
date: '31/01/18'
,

month: 'Feb',
value: 65.1,
color: '#ff6e52',
date: '28/02/18'
,

month: 'Mar',
value: 61.9,
color: '#f9de3f',
date: '31/03/18'
,

month: 'Apr',
value: 60.4,
color: '#5d2f8e',
date: '30/04/18'
,

month: 'May',
value: 59.6,
color: '#008fc9',
date: '31/05/18'
,

month: 'Jun',
value: 59.6,
color: '#507dca',
date: '30/06/18'
,

month: 'Jul',
value: 80.6,
color: '#507dca',
date: '31/07/18'
,

month: 'Aug',
value: 45.6,
color: '#507dca',
date: '31/08/18'
,

month: 'Sep ',
value: 78.6,
color: '#507dca',
date: '30/09/18'

];

const svg = d3.select('svg');
const svgContainer = d3.select('#container');

const margin = 80;
const width = 1000 - 2 * margin;
const height = 600 - 2 * margin;

const chart = svg.append('g')
.attr('transform', `translate($margin, $margin)`);

const xScale = d3.scale.ordinal()
.rangeRoundBands([0, width], 0.4)
.domain(sample.map((s) => s.month))

const yScale = d3.scale.linear()
.range([height, 0])
.domain([0, 100]);

// vertical grid lines
// const makeXLines = () => d3.axisBottom()
// .scale(xScale)

const makeYLines = () => d3.svg.axis().scale(yScale).orient("left")


chart.append('g')
.attr('transform', `translate(0, $height)`)
.call(d3.svg.axis().scale(xScale).orient("bottom").tickSize(1));

chart.append('g')
.call(d3.svg.axis().scale(yScale).orient("left").tickFormat(d3.format("d")).tickSize(1));

// vertical grid lines
// chart.append('g')
// .attr('class', 'grid')
// .attr('transform', `translate(0, $height)`)
// .call(makeXLines()
// .tickSize(-height, 0, 0)
// .tickFormat('')
// )

chart.append('g')
.attr('class', 'grid')
.call(makeYLines()
.tickSize(-width, 0, 0)
.tickFormat('')
)

const barGroups = chart.selectAll()
.data(sample)
.enter()
.append('g')

barGroups
.append('rect')
.attr('class', 'bar')
.attr('x', (g) => xScale(g.month))
.attr('y', (g) => yScale(g.value))
.attr('height', (g) => height - yScale(g.value))
.attr('width', xScale.rangeBand())
.on('mouseenter', function(actual, i)
d3.selectAll('.value')
.attr('opacity', 0)

d3.select(this)
.transition()
.duration(300)
.attr('opacity', 0.6)
.attr('x', (a) => xScale(a.month) - 5)
.attr('width', xScale.rangeBand() + 10)

const y = yScale(actual.value)

line = chart.append('line')
.attr('id', 'limit')
.attr('x1', 0)
.attr('y1', y)
.attr('x2', width)
.attr('y2', y)

barGroups.append('text')
.attr('class', 'divergence')
.attr('x', (a) => xScale(a.month) + xScale.bandwidth() / 2)
.attr('y', (a) => yScale(a.value) + 30)
.attr('fill', 'white')
.attr('text-anchor', 'middle')
.text((a, idx) =>
const divergence = (a.value - actual.value).toFixed(1)

let text = ''
if (divergence > 0) text += '+'
text += `$divergence%`

return idx !== i ? text : '';
)

)
.on('mouseleave', function()
d3.selectAll('.value')
.attr('opacity', 1)

d3.select(this)
.transition()
.duration(300)
.attr('opacity', 1)
.attr('x', (a) => xScale(a.month))
.attr('width', xScale.rangeBand())

chart.selectAll('#limit').remove()
chart.selectAll('.divergence').remove()
)

barGroups
.append('text')
.attr('class', 'value')
.attr('x', (a) => xScale(a.month) + xScale.rangeBand() / 2)
.attr('y', (a) => yScale(a.value) + 30)
.attr('text-anchor', 'middle')
.text((a) => `$a.value%`)

svg
.append('text')
.attr('class', 'label')
.attr('x', -(height / 2) - margin)
.attr('y', margin / 2.4)
.attr('transform', 'rotate(-90)')
.attr('text-anchor', 'middle')
.text('Love meter (%)')

svg.append('text')
.attr('class', 'label')
.attr('x', width / 2 + margin)
.attr('y', height + margin * 1.7)
.attr('text-anchor', 'middle')
.text('Months')

svg.append('text')
.attr('class', 'title')
.attr('x', width / 2 + margin)
.attr('y', 40)
.attr('text-anchor', 'middle')
.text('Most loved programming languages in 2018')

svg.append('text')
.attr('class', 'source')
.attr('x', width - margin / 2)
.attr('y', height + margin * 1.7)
.attr('text-anchor', 'start')
.text('Source: Stack Overflow, 2018')









share|improve this question
















I have developed a D3 chart using D3 version 3. In there I need to add a separator line in the chart to separate columns. The chart represents months and that line is used to separate the months of two years. Is there a possible way to add this kind of a line into a chart. Always the separator position is not fixed, it may be here and there depending on where January is marked in the chart. The following picture shows an expected behavior. And sample code is also given, Can someone give a solution for this problem



Fiddle : https://jsfiddle.net/yasirunilan/921fsugh/4/



enter image description here



const sample = [
month: 'Sep',
value: 78.9,
color: '#000000',
date: '30/09/17'
,

month: 'Oct',
value: 75.1,
color: '#00a2ee',
date: '31/10/17'
,

month: 'Nov',
value: 68.0,
color: '#fbcb39',
date: '30/11/17'
,

month: 'Dec',
value: 67.0,
color: '#007bc8',
date: '31/12/17'
,

month: 'Jan',
value: 65.6,
color: '#65cedb',
date: '31/01/18'
,

month: 'Feb',
value: 65.1,
color: '#ff6e52',
date: '28/02/18'
,

month: 'Mar',
value: 61.9,
color: '#f9de3f',
date: '31/03/18'
,

month: 'Apr',
value: 60.4,
color: '#5d2f8e',
date: '30/04/18'
,

month: 'May',
value: 59.6,
color: '#008fc9',
date: '31/05/18'
,

month: 'Jun',
value: 59.6,
color: '#507dca',
date: '30/06/18'
,

month: 'Jul',
value: 80.6,
color: '#507dca',
date: '31/07/18'
,

month: 'Aug',
value: 45.6,
color: '#507dca',
date: '31/08/18'
,

month: 'Sep ',
value: 78.6,
color: '#507dca',
date: '30/09/18'

];

const svg = d3.select('svg');
const svgContainer = d3.select('#container');

const margin = 80;
const width = 1000 - 2 * margin;
const height = 600 - 2 * margin;

const chart = svg.append('g')
.attr('transform', `translate($margin, $margin)`);

const xScale = d3.scale.ordinal()
.rangeRoundBands([0, width], 0.4)
.domain(sample.map((s) => s.month))

const yScale = d3.scale.linear()
.range([height, 0])
.domain([0, 100]);

// vertical grid lines
// const makeXLines = () => d3.axisBottom()
// .scale(xScale)

const makeYLines = () => d3.svg.axis().scale(yScale).orient("left")


chart.append('g')
.attr('transform', `translate(0, $height)`)
.call(d3.svg.axis().scale(xScale).orient("bottom").tickSize(1));

chart.append('g')
.call(d3.svg.axis().scale(yScale).orient("left").tickFormat(d3.format("d")).tickSize(1));

// vertical grid lines
// chart.append('g')
// .attr('class', 'grid')
// .attr('transform', `translate(0, $height)`)
// .call(makeXLines()
// .tickSize(-height, 0, 0)
// .tickFormat('')
// )

chart.append('g')
.attr('class', 'grid')
.call(makeYLines()
.tickSize(-width, 0, 0)
.tickFormat('')
)

const barGroups = chart.selectAll()
.data(sample)
.enter()
.append('g')

barGroups
.append('rect')
.attr('class', 'bar')
.attr('x', (g) => xScale(g.month))
.attr('y', (g) => yScale(g.value))
.attr('height', (g) => height - yScale(g.value))
.attr('width', xScale.rangeBand())
.on('mouseenter', function(actual, i)
d3.selectAll('.value')
.attr('opacity', 0)

d3.select(this)
.transition()
.duration(300)
.attr('opacity', 0.6)
.attr('x', (a) => xScale(a.month) - 5)
.attr('width', xScale.rangeBand() + 10)

const y = yScale(actual.value)

line = chart.append('line')
.attr('id', 'limit')
.attr('x1', 0)
.attr('y1', y)
.attr('x2', width)
.attr('y2', y)

barGroups.append('text')
.attr('class', 'divergence')
.attr('x', (a) => xScale(a.month) + xScale.bandwidth() / 2)
.attr('y', (a) => yScale(a.value) + 30)
.attr('fill', 'white')
.attr('text-anchor', 'middle')
.text((a, idx) =>
const divergence = (a.value - actual.value).toFixed(1)

let text = ''
if (divergence > 0) text += '+'
text += `$divergence%`

return idx !== i ? text : '';
)

)
.on('mouseleave', function()
d3.selectAll('.value')
.attr('opacity', 1)

d3.select(this)
.transition()
.duration(300)
.attr('opacity', 1)
.attr('x', (a) => xScale(a.month))
.attr('width', xScale.rangeBand())

chart.selectAll('#limit').remove()
chart.selectAll('.divergence').remove()
)

barGroups
.append('text')
.attr('class', 'value')
.attr('x', (a) => xScale(a.month) + xScale.rangeBand() / 2)
.attr('y', (a) => yScale(a.value) + 30)
.attr('text-anchor', 'middle')
.text((a) => `$a.value%`)

svg
.append('text')
.attr('class', 'label')
.attr('x', -(height / 2) - margin)
.attr('y', margin / 2.4)
.attr('transform', 'rotate(-90)')
.attr('text-anchor', 'middle')
.text('Love meter (%)')

svg.append('text')
.attr('class', 'label')
.attr('x', width / 2 + margin)
.attr('y', height + margin * 1.7)
.attr('text-anchor', 'middle')
.text('Months')

svg.append('text')
.attr('class', 'title')
.attr('x', width / 2 + margin)
.attr('y', 40)
.attr('text-anchor', 'middle')
.text('Most loved programming languages in 2018')

svg.append('text')
.attr('class', 'source')
.attr('x', width - margin / 2)
.attr('y', height + margin * 1.7)
.attr('text-anchor', 'start')
.text('Source: Stack Overflow, 2018')






javascript d3.js charts






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 16 '18 at 6:27









Krupesh Kotecha

2,07311136




2,07311136










asked Nov 16 '18 at 6:24









Yasiru NilanYasiru Nilan

8810




8810












  • Is this => stackoverflow.com/questions/52752764/… a duplicate of this ticket? Just curious to know.

    – David R
    Nov 16 '18 at 6:34











  • Quite similar, the solutions given in that question is not valid for D3v3 that's why I raised a separate question with D3 V3 code.

    – Yasiru Nilan
    Nov 16 '18 at 6:37











  • Okay.. Got it!.

    – David R
    Nov 16 '18 at 6:37











  • @DavidR but it is duplicate of stackoverflow.com/q/53316144/9938317

    – rioV8
    Nov 16 '18 at 6:45






  • 1





    Possible duplicate of How to add a separator in D3 bar chart D3V3

    – rioV8
    Nov 16 '18 at 6:45

















  • Is this => stackoverflow.com/questions/52752764/… a duplicate of this ticket? Just curious to know.

    – David R
    Nov 16 '18 at 6:34











  • Quite similar, the solutions given in that question is not valid for D3v3 that's why I raised a separate question with D3 V3 code.

    – Yasiru Nilan
    Nov 16 '18 at 6:37











  • Okay.. Got it!.

    – David R
    Nov 16 '18 at 6:37











  • @DavidR but it is duplicate of stackoverflow.com/q/53316144/9938317

    – rioV8
    Nov 16 '18 at 6:45






  • 1





    Possible duplicate of How to add a separator in D3 bar chart D3V3

    – rioV8
    Nov 16 '18 at 6:45
















Is this => stackoverflow.com/questions/52752764/… a duplicate of this ticket? Just curious to know.

– David R
Nov 16 '18 at 6:34





Is this => stackoverflow.com/questions/52752764/… a duplicate of this ticket? Just curious to know.

– David R
Nov 16 '18 at 6:34













Quite similar, the solutions given in that question is not valid for D3v3 that's why I raised a separate question with D3 V3 code.

– Yasiru Nilan
Nov 16 '18 at 6:37





Quite similar, the solutions given in that question is not valid for D3v3 that's why I raised a separate question with D3 V3 code.

– Yasiru Nilan
Nov 16 '18 at 6:37













Okay.. Got it!.

– David R
Nov 16 '18 at 6:37





Okay.. Got it!.

– David R
Nov 16 '18 at 6:37













@DavidR but it is duplicate of stackoverflow.com/q/53316144/9938317

– rioV8
Nov 16 '18 at 6:45





@DavidR but it is duplicate of stackoverflow.com/q/53316144/9938317

– rioV8
Nov 16 '18 at 6:45




1




1





Possible duplicate of How to add a separator in D3 bar chart D3V3

– rioV8
Nov 16 '18 at 6:45





Possible duplicate of How to add a separator in D3 bar chart D3V3

– rioV8
Nov 16 '18 at 6:45












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53332524%2fhow-to-add-a-line-inside-a-d3-chart%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53332524%2fhow-to-add-a-line-inside-a-d3-chart%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Top Tejano songwriter Luis Silva dead of heart attack at 64

ReactJS Fetched API data displays live - need Data displayed static

Evgeni Malkin