Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#4625 closed defect (wontfix)

"Patch" to allow setting tooltips on plotted markers + IE fixes

Reported by: guest Owned by: Tom Trenka
Priority: high Milestone:
Component: Charting Version: 0.4.2
Keywords: tooltip, onclick event Cc: danielebenegiamo@…
Blocked By: Blocking:

Description

Sorry if this is not a real patch, but I hope it could be useful anyway.

The following are some modifications to Dojo Charting v 0.4.3 to uses the "applyTo" features of Plotters to add tooltips to plotted markers, and two fixes for IE to displaying them correctly.

First a variant of Chart.render() to allow passing "applyTo" parameter:

dojo.charting.Chart.prototype.applyToRender = function (kwArgs, applyTo)
{
	if (this.node.style.position != "absolute") {
		this.node.style.position = "relative";
	}
	for (var i = 0; i < this.plotAreas.length; i++) {
		var area = this.plotAreas[i].plotArea;
		var node = area.initialize();
		node.style.position = "absolute";
		node.style.top = this.plotAreas[i].top + "px";
		node.style.left = this.plotAreas[i].left + "px";
		this.node.appendChild(node);
		// *** Modified line. ***
		//area.render ();
		area.render (kwArgs, applyTo);
	}
}

Then the first fix for IE to be able to "hover" with mouse on plotted markers:

if (dojo.render.vml.capable && ! dojo.render.svg.capable)
{
	dojo.charting.Plotters._group = function (plotarea)
	{
		var group = document.createElement("div");
		// *** Commented out style. ***
		//group.style.position = "absolute";
		//group.style.top = "0px";
		//group.style.left = "0px";
		group.style.width = plotarea.size.width + "px";
		group.style.height = plotarea.size.height + "px";
		return group;
	}
}

All this allow the following (with a second fix for IE):

someChart.applyToRender (
        null,
        function (marker, data) {
                marker.setAttribute (
			"title",
			data.fieldX + ' ' + data.fieldY
		);
                marker.onclick = function () { alert ('click'); }

                // Last fix for IE, otherwise markers are under the line
                if (dojo.render.vml.capable && ! dojo.render.svg.capable)
		{
			marker.style.zIndex = 10;
		}
        }

Regards,

Daniele

Change History (2)

comment:1 Changed 12 years ago by Tom Trenka

Resolution: wontfix
Status: newclosed

Hi Daniele,

Thanks for the patch submissions. We're currently rewriting the charting engine for the Dojo 1.0 release, and are already building this capability into the new version using dojox.gfx--but we appreciate the submission nonetheless.

comment:2 Changed 12 years ago by (none)

Milestone: 0.4.4

Milestone 0.4.4 deleted

Note: See TracTickets for help on using tickets.