|
38 | 38 |
|
39 | 39 | // Create the stub object |
40 | 40 | var dimple = { |
41 | | - version: "2.1.5", |
| 41 | + version: "2.1.6", |
42 | 42 | plot: {}, |
43 | 43 | aggregateMethod: {} |
44 | 44 | }; |
|
1600 | 1600 | axisTitle: 'dimple-custom-axis-title', |
1601 | 1601 | tooltipBox: 'dimple-custom-tooltip-box', |
1602 | 1602 | tooltipLabel: 'dimple-custom-tooltip-label', |
| 1603 | + tooltipDropLine: 'dimple-custom-tooltip-dropline', |
1603 | 1604 | lineMarker: 'dimple-custom-line-marker', |
1604 | 1605 | legendLabel: 'dimple-custom-legend-label', |
1605 | 1606 | legendKey: 'dimple-custom-legend-key', |
|
3446 | 3447 | // Apply formats optionally |
3447 | 3448 | if (!chart.noFormats) { |
3448 | 3449 | this.attr("opacity", function (d) { return (graded ? 1 : d.color.opacity); }) |
3449 | | - .style("fill", function (d) { return (graded ? "url(#fill-area-gradient-" + d.keyString + ")" : d.color.fill); }) |
3450 | | - .style("stroke", function (d) { return (graded ? "url(#stroke-area-gradient-" + d.keyString + ")" : d.color.stroke); }) |
| 3450 | + .style("fill", function (d) { return (graded ? "url(#" + dimple._createClass(["fill-area-gradient-" + d.keyString]) + ")" : d.color.fill); }) |
| 3451 | + .style("stroke", function (d) { return (graded ? "url(#" + dimple._createClass(["stroke-area-gradient-" + d.keyString]) + ")" : d.color.stroke); }) |
3451 | 3452 | .style("stroke-width", series.lineWeight); |
3452 | 3453 | } |
3453 | 3454 | }) |
|
3894 | 3895 | if (!chart.noFormats) { |
3895 | 3896 | this.attr("opacity", function (d) { return (graded ? 1 : d.color.opacity); }) |
3896 | 3897 | .style("fill", "none") |
3897 | | - .style("stroke", function (d) { return (graded ? "url(#fill-line-gradient-" + d.keyString + ")" : d.color.stroke); }) |
| 3898 | + .style("stroke", function (d) { return (graded ? "url(#" + dimple._createClass(["fill-line-gradient-" + d.keyString]) + ")" : d.color.stroke); }) |
3898 | 3899 | .style("stroke-width", series.lineWeight); |
3899 | 3900 | } |
3900 | 3901 | }) |
|
4092 | 4093 | dimple._addGradient = function (seriesValue, id, categoryAxis, data, chart, duration, colorProperty) { |
4093 | 4094 |
|
4094 | 4095 | var sArray = [].concat(seriesValue), |
4095 | | - grad = chart._group.select("#" + id), |
| 4096 | + grad = chart.svg.select("#" + dimple._createClass([id])), |
4096 | 4097 | cats = [], |
4097 | 4098 | field = categoryAxis.position + "Field", |
4098 | 4099 | transition = true, |
|
4108 | 4109 |
|
4109 | 4110 | if (grad.node() === null) { |
4110 | 4111 | transition = false; |
4111 | | - grad = chart._group.append("linearGradient") |
| 4112 | + grad = chart.svg.append("defs").append("linearGradient") |
4112 | 4113 | .attr("id", dimple._createClass([id])) |
4113 | 4114 | .attr("gradientUnits", "userSpaceOnUse") |
4114 | 4115 | .attr("x1", (categoryAxis.position === "x" ? categoryAxis._scale(cats[0]) + ((chart._widthPixels() / cats.length) / 2) : 0)) |
|
5031 | 5032 | // Add a drop line to the x axis |
5032 | 5033 | if (!series.x._hasCategories() && dropDest.y !== null) { |
5033 | 5034 | chart._tooltipGroup.append("line") |
| 5035 | + .attr("class", "dimple-tooltip-dropline " + chart.customClassList.tooltipDropLine) |
5034 | 5036 | .attr("x1", (x < series.x._origin ? x + offset : x + width - offset)) |
5035 | 5037 | .attr("y1", (y < dropDest.y ? y + height : y)) |
5036 | 5038 | .attr("x2", (x < series.x._origin ? x + offset : x + width - offset)) |
5037 | 5039 | .attr("y2", (y < dropDest.y ? y + height : y)) |
5038 | | - .style("fill", "none") |
5039 | | - .style("stroke", fill) |
5040 | | - .style("stroke-width", 2) |
5041 | | - .style("stroke-dasharray", ("3, 3")) |
5042 | | - .style("opacity", opacity) |
| 5040 | + .call(function () { |
| 5041 | + // Apply formats optionally |
| 5042 | + if (!chart.noFormats) { |
| 5043 | + this.style("fill", "none") |
| 5044 | + .style("stroke", fill) |
| 5045 | + .style("stroke-width", 2) |
| 5046 | + .style("stroke-dasharray", ("3, 3")) |
| 5047 | + .style("opacity", opacity); |
| 5048 | + } |
| 5049 | + }) |
5043 | 5050 | .transition() |
5044 | 5051 | .delay(animDuration / 2) |
5045 | 5052 | .duration(animDuration / 2) |
|
5055 | 5062 | // Add a drop line to the y axis |
5056 | 5063 | if (!series.y._hasCategories() && dropDest.x !== null) { |
5057 | 5064 | chart._tooltipGroup.append("line") |
| 5065 | + .attr("class", "dimple-tooltip-dropline " + chart.customClassList.tooltipDropLine) |
5058 | 5066 | .attr("x1", (x < dropDest.x ? x + width : x)) |
5059 | 5067 | .attr("y1", (y < series.y._origin ? y + offset : y + height - offset)) |
5060 | 5068 | .attr("x2", (x < dropDest.x ? x + width : x)) |
5061 | 5069 | .attr("y2", (y < series.y._origin ? y + offset : y + height - offset)) |
5062 | | - .style("fill", "none") |
5063 | | - .style("stroke", fill) |
5064 | | - .style("stroke-width", 2) |
5065 | | - .style("stroke-dasharray", ("3, 3")) |
5066 | | - .style("opacity", opacity) |
| 5070 | + .call(function () { |
| 5071 | + // Apply formats optionally |
| 5072 | + if (!chart.noFormats) { |
| 5073 | + this.style("fill", "none") |
| 5074 | + .style("stroke", fill) |
| 5075 | + .style("stroke-width", 2) |
| 5076 | + .style("stroke-dasharray", ("3, 3")) |
| 5077 | + .style("opacity", opacity); |
| 5078 | + } |
| 5079 | + }) |
5067 | 5080 | .transition() |
5068 | 5081 | .delay(animDuration / 2) |
5069 | 5082 | .duration(animDuration / 2) |
|
5087 | 5100 | .append("text") |
5088 | 5101 | .attr("class", "dimple-tooltip " + chart.customClassList.tooltipLabel) |
5089 | 5102 | .text(function (d) { return d; }) |
5090 | | - .style("font-family", series.tooltipFontFamily) |
5091 | | - .style("font-size", series._getTooltipFontSize()); |
| 5103 | + .call(function () { |
| 5104 | + // Apply formats optionally |
| 5105 | + if (!chart.noFormats) { |
| 5106 | + this.style("font-family", series.tooltipFontFamily) |
| 5107 | + .style("font-size", series._getTooltipFontSize()); |
| 5108 | + } |
| 5109 | + }); |
5092 | 5110 |
|
5093 | 5111 | // Get the max height and width of the text items |
5094 | 5112 | t.each(function () { |
|
5114 | 5132 | .attr("width", w + 2 * textMargin) |
5115 | 5133 | .attr("rx", 5) |
5116 | 5134 | .attr("ry", 5) |
5117 | | - .style("fill", popupFillColor) |
5118 | | - .style("stroke", popupStrokeColor) |
5119 | | - .style("stroke-width", 2) |
5120 | | - .style("opacity", 0.95); |
| 5135 | + .call(function () { |
| 5136 | + // Apply formats optionally |
| 5137 | + if (!chart.noFormats) { |
| 5138 | + this.style("fill", popupFillColor) |
| 5139 | + .style("stroke", popupStrokeColor) |
| 5140 | + .style("stroke-width", 2) |
| 5141 | + .style("opacity", 0.95); |
| 5142 | + } |
| 5143 | + }); |
| 5144 | + |
5121 | 5145 |
|
5122 | 5146 | // Shift the popup around to avoid overlapping the svg edge |
5123 | 5147 | if (transformPoint(x + width + textMargin + popupMargin + w).x < parseFloat(chart.svg.node().getBBox().width)) { |
|
5196 | 5220 | .attr("cx", cx) |
5197 | 5221 | .attr("cy", cy) |
5198 | 5222 | .attr("r", r) |
5199 | | - .attr("opacity", 0) |
5200 | | - .style("fill", "none") |
5201 | | - .style("stroke", fill) |
5202 | | - .style("stroke-width", 1) |
| 5223 | + .call(function () { |
| 5224 | + if (!chart.noFormats) { |
| 5225 | + this.attr("opacity", 0) |
| 5226 | + .style("fill", "none") |
| 5227 | + .style("stroke", fill) |
| 5228 | + .style("stroke-width", 1); |
| 5229 | + } |
| 5230 | + }) |
5203 | 5231 | .transition() |
5204 | 5232 | .duration(animDuration / 2) |
5205 | 5233 | .ease("linear") |
5206 | | - .attr("opacity", 1) |
5207 | 5234 | .attr("r", r + series.lineWeight + 2) |
5208 | | - .style("stroke-width", 2); |
| 5235 | + .call(function () { |
| 5236 | + if (!chart.noFormats) { |
| 5237 | + this.attr("opacity", 1) |
| 5238 | + .style("stroke-width", 2); |
| 5239 | + } |
| 5240 | + }); |
5209 | 5241 |
|
5210 | 5242 | // Add a drop line to the x axis |
5211 | 5243 | if (dropDest.y !== null) { |
5212 | 5244 | chart._tooltipGroup.append("line") |
| 5245 | + .attr("class", "dimple-tooltip-dropline " + chart.customClassList.tooltipDropLine) |
5213 | 5246 | .attr("x1", cx) |
5214 | 5247 | .attr("y1", (cy < dropDest.y ? cy + r + series.lineWeight + 2 : cy - r - series.lineWeight - 2)) |
5215 | 5248 | .attr("x2", cx) |
5216 | 5249 | .attr("y2", (cy < dropDest.y ? cy + r + series.lineWeight + 2 : cy - r - series.lineWeight - 2)) |
5217 | | - .style("fill", "none") |
5218 | | - .style("stroke", fill) |
5219 | | - .style("stroke-width", 2) |
5220 | | - .style("stroke-dasharray", ("3, 3")) |
5221 | | - .style("opacity", opacity) |
| 5250 | + .call(function () { |
| 5251 | + if (!chart.noFormats) { |
| 5252 | + this.style("fill", "none") |
| 5253 | + .style("stroke", fill) |
| 5254 | + .style("stroke-width", 2) |
| 5255 | + .style("stroke-dasharray", ("3, 3")) |
| 5256 | + .style("opacity", opacity); |
| 5257 | + } |
| 5258 | + }) |
5222 | 5259 | .transition() |
5223 | 5260 | .delay(animDuration / 2) |
5224 | 5261 | .duration(animDuration / 2) |
|
5232 | 5269 | // Add a drop line to the y axis |
5233 | 5270 | if (dropDest.x !== null) { |
5234 | 5271 | chart._tooltipGroup.append("line") |
| 5272 | + .attr("class", "dimple-tooltip-dropline " + chart.customClassList.tooltipDropLine) |
5235 | 5273 | .attr("x1", (cx < dropDest.x ? cx + r + series.lineWeight + 2 : cx - r - series.lineWeight - 2)) |
5236 | 5274 | .attr("y1", cy) |
5237 | 5275 | .attr("x2", (cx < dropDest.x ? cx + r + series.lineWeight + 2 : cx - r - series.lineWeight - 2)) |
5238 | 5276 | .attr("y2", cy) |
5239 | | - .style("fill", "none") |
5240 | | - .style("stroke", fill) |
5241 | | - .style("stroke-width", 2) |
5242 | | - .style("stroke-dasharray", ("3, 3")) |
5243 | | - .style("opacity", opacity) |
| 5277 | + .call(function () { |
| 5278 | + if (!chart.noFormats) { |
| 5279 | + this.style("fill", "none") |
| 5280 | + .style("stroke", fill) |
| 5281 | + .style("stroke-width", 2) |
| 5282 | + .style("stroke-dasharray", ("3, 3")) |
| 5283 | + .style("opacity", opacity); |
| 5284 | + } |
| 5285 | + }) |
5244 | 5286 | .transition() |
5245 | 5287 | .delay(animDuration / 2) |
5246 | 5288 | .duration(animDuration / 2) |
|
5255 | 5297 | t = chart._tooltipGroup.append("g"); |
5256 | 5298 | // Create a box for the popup in the text group |
5257 | 5299 | box = t.append("rect") |
5258 | | - .attr("class", "dimple-tooltip"); |
| 5300 | + .attr("class", "dimple-tooltip " + chart.customClassList.tooltipBox); |
5259 | 5301 |
|
5260 | 5302 | // Create a text object for every row in the popup |
5261 | 5303 | t.selectAll(".dont-select-any").data(tipText).enter() |
5262 | 5304 | .append("text") |
5263 | | - .attr("class", "dimple-tooltip") |
| 5305 | + .attr("class", "dimple-tooltip " + chart.customClassList.tooltipLabel) |
5264 | 5306 | .text(function (d) { return d; }) |
5265 | | - .style("font-family", series.tooltipFontFamily) |
5266 | | - .style("font-size", series._getTooltipFontSize()); |
| 5307 | + .call(function () { |
| 5308 | + if (!chart.noFormats) { |
| 5309 | + this.style("font-family", series.tooltipFontFamily) |
| 5310 | + .style("font-size", series._getTooltipFontSize()); |
| 5311 | + } |
| 5312 | + }); |
5267 | 5313 |
|
5268 | 5314 | // Get the max height and width of the text items |
5269 | 5315 | t.each(function () { |
|
5289 | 5335 | .attr("width", w + 2 * textMargin) |
5290 | 5336 | .attr("rx", 5) |
5291 | 5337 | .attr("ry", 5) |
5292 | | - .style("fill", popupFillColor) |
5293 | | - .style("stroke", popupStrokeColor) |
5294 | | - .style("stroke-width", 2) |
5295 | | - .style("opacity", 0.95); |
| 5338 | + .call(function () { |
| 5339 | + if (!chart.noFormats) { |
| 5340 | + this.style("fill", popupFillColor) |
| 5341 | + .style("stroke", popupStrokeColor) |
| 5342 | + .style("stroke-width", 2) |
| 5343 | + .style("opacity", 0.95); |
| 5344 | + } |
| 5345 | + }); |
5296 | 5346 |
|
5297 | 5347 | // Shift the popup around to avoid overlapping the svg edge |
5298 | 5348 | if (cx + r + textMargin + popupMargin + w < parseFloat(chart.svg.node().getBBox().width)) { |
|
0 commit comments