Building on the Quick Start example, you can customize the animation of the hint that shows when you mouse over the bars in your chart.
There are now two methods for doing this. The newer method, available since Wijmo 2013, uses wijmo.ChartTooltip.animations.
Note: The default value for the hint option's animated attribute is "fade." To use any other, you must create a custom animation. You can set the hideAnimated and showAnimated attributes to use different animations, or set them to null so that they default to the value you assign to animated.
Drop down and copy code
Customize Tooltip Animation Script |
Copy Code |
---|---|
<script id="scriptInit" type="text/javascript"> $(document).ready(function () { $("#wijbarchart").wijbarchart({ hint: { animated: "scale", hideAnimated: null, showAnimated: null }, seriesList: [{ label: "2012 Auto Sales ", legendEntry: false, data: { x: ['Ford', 'GM', 'Chrysler', 'Toyota', 'Nissan', 'Honda'], y: [.05, .04, .21, .27, .1, .24] } }], }); Raphael.fn.tooltip.animations.scale = function (options) { context = options.context, bBox = context.wijGetBBox(), w = bBox.width, h = bBox.height; if (options.show) { scaleSet(context, options.duration, options.easing); } else { context.wijAnimate({"transform": "...s0"}, options.duration, options.easing); } } function scaleSet(set, duration, easing) { $.each(set, function (i, s) { if (s.type === "set") { scaleSet(s, duration, easing); } else { var transform = s.attr("transform"); s.wijAttr("transform", "...s0"); s.wijAnimate({"transform": transform}, duration, easing); } }); } }); </script> |
Drop down and copy code for Wijmo v3 2013
Customize Tooltip Animation Script |
Copy Code |
---|---|
<script id="scriptInit" type="text/javascript"> $(document).ready(function () { $("#wijbarchart").wijbarchart({ hint: { animated: "scale", hideAnimated: null, showAnimated: null }, seriesList: [{ label: "2012 Auto Sales ", legendEntry: false, data: { x: ['Ford', 'GM', 'Chrysler', 'Toyota', 'Nissan', 'Honda'], y: [.05, .04, .21, .27, .1, .24] } }], }); wijmo.ChartTooltip.animations.scale = function (options) { context = options.context, bBox = context.wijGetBBox(), w = bBox.width, h = bBox.height; if (options.show) { scaleSet(context, options.duration, options.easing); } else { context.wijAnimate({ "transform": "...s0" }, options.duration, options.easing); } } function scaleSet(set, duration, easing) { $.each(set, function (i, s) { if (s.type === "set") { scaleSet(s, duration, easing); } else { var transform = s.attr("transform"); s.wijAttr("transform", "...s0"); s.wijAnimate({"transform": transform}, duration, easing); } }); } }); </script> |