Skip to content
Browse files

More complex interaction

  • Loading branch information...
1 parent ecd8168 commit 870123e415dd1c95a6094816ae9b350b60ac7790 @irae committed May 24, 2010
Showing with 34 additions and 2 deletions.
  1. +1 −1 index.html
  2. +33 −1 interactive.html
View
2 index.html
@@ -20,7 +20,7 @@
</head>
<body>
<h1>jQuery Visualize demos</h1>
-<p><a href="interaction.html">See also with interaction</a></p>
+<p><a href="interactive.html">See also with interaction</a></p>
<h2>Charts from the same data</h2>
View
34 interactive.html
@@ -18,13 +18,45 @@
title: '2009 Total Sales by Individual',
interaction: true,
tooltip: true
- });
+ });
$('table.line').visualize({
type: 'line',
lineDots: 'double',
interaction: true,
tooltip: true
});
+
+ // Change inner color on mouseover intecation
+ if(!$.browser.msie) { // IE is a bit slow, but is possible. Future versions may solve this problem
+ var currentHoverPoint = null;
+ // listen for hovering events
+ $('table.line')
+ .bind('vizualizeOver',function(e,data){
+ currentHoverPoint = data.point;
+ $(data.point.elem).parents('table').trigger('visualizeRedraw');
+ })
+ .bind('vizualizeOut',function(e,data){
+ currentHoverPoint = null;
+ $(data.point.elem).parents('table').trigger('visualizeRedraw');
+ });
+
+ // Modify painting for hovering effect
+ $('table.line').bind('vizualizeBeforeDraw',function hoverBeforeDraw(e,data){
+ if(currentHoverPoint) {
+ var item,i,j,len = data.tableData.allItems.length;
+ for(i=0;i<len;i+=1) { item = data.tableData.allItems[i];
+ if(currentHoverPoint == item) {
+ item.innerColor = item.color;
+ // item.dotSize = item.dotSize*1.4;
+ // item.dotInnerSize = item.dotInnerSize*1.4;
+ }
+ }
+ }
+ });
+
+ }
+
+
});
</script>
</head>

0 comments on commit 870123e

Please sign in to comment.
Something went wrong with that request. Please try again.