Commit e44ce25b authored by Masayuki Tanaka's avatar Masayuki Tanaka

Fix clipId to unique for each chart - #109 #110

parent 543d9ebf
...@@ -259,7 +259,11 @@ ...@@ -259,7 +259,11 @@
/*-- Set Variables --*/ /*-- Set Variables --*/
var clipId = (typeof __bindto === "string" ? __bindto.replace('#', '') : __bindto.id) + '-clip', var clipId = (typeof __bindto === "string" ? __bindto.replace('#', '') : __bindto.id) + '-clip',
clipPath = getClipPath(clipId); clipIdForXAxis = clipId + '-xaxis',
clipIdForYAxis = clipId + '-yaxis',
clipPath = getClipPath(clipId),
clipPathForXAxis = getClipPath(clipPathForXAxis),
clipPathForYAxis = getClipPath(clipPathForYAxis);
var isTimeSeries = (__axis_x_type === 'timeseries'), var isTimeSeries = (__axis_x_type === 'timeseries'),
isCategorized = (__axis_x_type === 'categorized'), isCategorized = (__axis_x_type === 'categorized'),
...@@ -2308,14 +2312,14 @@ ...@@ -2308,14 +2312,14 @@
.attr("width", width) .attr("width", width)
.attr("height", height); .attr("height", height);
defs.append("clipPath") defs.append("clipPath")
.attr("id", "xaxis-clip") .attr("id", clipIdForXAxis)
.append("rect") .append("rect")
.attr("x", getXAxisClipX) .attr("x", getXAxisClipX)
.attr("y", getXAxisClipY) .attr("y", getXAxisClipY)
.attr("width", getXAxisClipWidth) .attr("width", getXAxisClipWidth)
.attr("height", getXAxisClipHeight); .attr("height", getXAxisClipHeight);
defs.append("clipPath") defs.append("clipPath")
.attr("id", "yaxis-clip") .attr("id", clipIdForYAxis)
.append("rect") .append("rect")
.attr("x", getYAxisClipX) .attr("x", getYAxisClipX)
.attr("y", getYAxisClipY) .attr("y", getYAxisClipY)
...@@ -2341,7 +2345,7 @@ ...@@ -2341,7 +2345,7 @@
// Add Axis // Add Axis
main.append("g") main.append("g")
.attr("class", CLASS.axisX) .attr("class", CLASS.axisX)
.attr("clip-path", __axis_rotated ? "" : getClipPath("xaxis-clip")) .attr("clip-path", __axis_rotated ? "" : clipPathForXAxis)
.attr("transform", translate.x) .attr("transform", translate.x)
.append("text") .append("text")
.attr("class", CLASS.axisXLabel) .attr("class", CLASS.axisXLabel)
...@@ -2353,7 +2357,7 @@ ...@@ -2353,7 +2357,7 @@
if (__axis_y_show) { if (__axis_y_show) {
main.append("g") main.append("g")
.attr("class", CLASS.axisY) .attr("class", CLASS.axisY)
.attr("clip-path", __axis_rotated ? getClipPath("yaxis-clip") : "") .attr("clip-path", __axis_rotated ? clipPathForYAxis : "")
.append("text") .append("text")
.attr("class", CLASS.axisYLabel) .attr("class", CLASS.axisYLabel)
.attr("transform", __axis_rotated ? "" : "rotate(-90)") .attr("transform", __axis_rotated ? "" : "rotate(-90)")
...@@ -2486,7 +2490,7 @@ ...@@ -2486,7 +2490,7 @@
context.append("g") context.append("g")
.attr("class", CLASS.axisX) .attr("class", CLASS.axisX)
.attr("transform", translate.subx) .attr("transform", translate.subx)
.attr("clip-path", __axis_rotated ? "" : getClipPath("xaxis-clip")); .attr("clip-path", __axis_rotated ? "" : clipPathForXAxis);
} }
// Set targets // Set targets
...@@ -3250,8 +3254,8 @@ ...@@ -3250,8 +3254,8 @@
function updateSvgSize() { function updateSvgSize() {
svg.attr('width', currentWidth).attr('height', currentHeight); svg.attr('width', currentWidth).attr('height', currentHeight);
svg.select('#' + clipId).select('rect').attr('width', width).attr('height', height); svg.select('#' + clipId).select('rect').attr('width', width).attr('height', height);
svg.select('#xaxis-clip').select('rect').attr('width', getXAxisClipWidth); svg.select('#' + clipIdForXAxis).select('rect').attr('width', getXAxisClipWidth);
svg.select('#yaxis-clip').select('rect').attr('width', getYAxisClipWidth); svg.select('#' + clipIdForYAxis).select('rect').attr('width', getYAxisClipWidth);
svg.select('.' + CLASS.zoomRect).attr('width', width).attr('height', height); svg.select('.' + CLASS.zoomRect).attr('width', width).attr('height', height);
} }
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment