Browse Source

Fix regions

pull/1/head
Masayuki Tanaka 12 years ago committed by masayuki
parent
commit
d3e6f44162
  1. 21
      c3.js

21
c3.js

@ -97,7 +97,7 @@
__point_onunselected = getConfig(['point','onunselected'], function(){}) __point_onunselected = getConfig(['point','onunselected'], function(){})
// region - region to change style // region - region to change style
var __regions = getConfig(['regions'], null) var __regions = getConfig(['regions'], [])
// tooltip - show when mouseover on each data // tooltip - show when mouseover on each data
var __tooltip_contents = getConfig(['tooltip','contents'], function(d) { var __tooltip_contents = getConfig(['tooltip','contents'], function(d) {
@ -802,14 +802,9 @@
} }
// Area // Area
if (__regions !== null) { main.append('g')
grid.append('g') .attr("clip-path", clipPath)
.attr("class", "regions") .attr("class", "regions")
.selectAll('rect.region')
.data(__regions)
.enter().append('rect')
.attr('class', function(d,i){ return 'region region-' + i })
}
// Define g for chart area // Define g for chart area
main.append('g') main.append('g')
@ -1250,12 +1245,16 @@
.attr("height", __axis_rotated ? rectW : height) .attr("height", __axis_rotated ? rectW : height)
// rect for regions // rect for regions
main.selectAll('rect.region') mainRegion = main.select('.regions').selectAll('rect.region')
.data(__regions)
mainRegion.enter().append('rect')
.attr('class', function(d,i){ return 'region region-' + i })// TODO: fix class
mainRegion
.attr("x", __axis_rotated ? 0 : regionStart) .attr("x", __axis_rotated ? 0 : regionStart)
.attr("y", __axis_rotated ? regionStart : margin.top) .attr("y", __axis_rotated ? regionStart : margin.top)
.attr("width", __axis_rotated ? width : regionWidth) .attr("width", __axis_rotated ? width : regionWidth)
.attr("height", __axis_rotated ? regionWidth : height) .attr("height", __axis_rotated ? regionWidth : height)
// TODO: enter/exti section for data add/remove mainRegion.exit().remove()
} }
function updateTargets (targets) { function updateTargets (targets) {

Loading…
Cancel
Save