Welcome to mirror list, hosted at ThFree Co, Russian Federation.

sparkline.js « templates « Home « plugins - github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7594c91dd4cfef93a672d0ae71579e4176cc28a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59

$(document).ready( function(){

	//for every section
	$("a[name='evolutionGraph']").each(
		function()
		{
			//try to find the graph
			var graph = $(this);
		
			if(graph && graph.size() > 0)
			{
				//console.log($(this).parent());
				//try to find sparklines and add them clickable behaviour
				$(this).parent().find('p').each(
					function()
					{
						var url = "";
						//find the sparkline and get it's src attribute
						$(".sparkline", this).each(
							function()
							{
								//search viewDataTable parameter and replace it with value for chart
								var reg = new RegExp("(viewDataTable=sparkline)", "g");
								url = this.src.replace(reg,'viewDataTable=generateDataChartEvolution');
							}
						);
						
						if(url != "")
						{
							$("*", this).each(
								function()
								{
									//on click, reload the graph with the new url
									$(this).click(
										function()
										{	
											//get the main page graph and reload with new data
											findSWFGraph(graph.attr('graphId')+"Chart_swf").reload(url);
											lazyScrollTo(graph[0], 400);
										}
									);
									
									//on hover, change cursor to indicate clickable item
									$(this).hover(
										function()
										{  
									 		$(this).css({ cursor: "pointer"}); 
									  	}, function (){}
									);
								}
							);
						}
					}
				);
			}
		}
	);
});