1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- // Licensed Materials - Property of IBM
- //
- // IBM Cognos Products: cogadmin
- //
- // (C) Copyright IBM Corp. 2005, 2011
- //
- // US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- //
- //
- dojo.provide("com.ibm.cognos.admin.chart.Base");
- dojo.require("dojox.json.ref");
- dojo.require("dojo.fx.easing");
- dojo.require("dojox.gfx.fx");
- (function(){
- dojo.declare("com.ibm.cognos.admin.chart.Base",null,{
- constructor : function (frag,args){
- this.frag = frag;
- },
- /*
- * make the label a 'mod' times integer and always bigger than min.
- *
- * @param min: the minimum value for ticks
- * @param max: the max value of Series
- * @param mod: the mod value for the ticks
- */
- getMaxLabel: function(min,max,mod) {
- var mod = mod || 15;
- if (max <= min) return min;
-
- var delta = max % mod;
- if (delta == 0) {
- return max;
- } else {
- return max + mod - delta;
- }
- },
- highlightedColumn: function(shape /*dojo chart shape*/,reversed){
- var DEFAULT_SATURATION = 100, // %
- DEFAULT_LUMINOSITY1 = 75, // %
- DEFAULT_LUMINOSITY2 = 50, // %
- DURATION = 400,
- EASING = dojo.fx.easing.backOut,
-
- c = dojox.color,
- hl = function(color){
- var a = new c.Color(color),
- x = a.toHsl();
- if(x.s == 0){
- x.l = x.l < 50 ? 100 : 0;
- }else{
- x.s = DEFAULT_SATURATION;
- if(x.l < DEFAULT_LUMINOSITY2){
- x.l = DEFAULT_LUMINOSITY1;
- }else if(x.l > DEFAULT_LUMINOSITY1){
- x.l = DEFAULT_LUMINOSITY2;
- }else{
- x.l = x.l - DEFAULT_LUMINOSITY2 > DEFAULT_LUMINOSITY1 - x.l ?
- DEFAULT_LUMINOSITY2 : DEFAULT_LUMINOSITY1;
- }
- }
- return c.fromHsl(x);
- };
-
- var color = shape.getFill();
- if(!color || !(color instanceof dojo.Color)){
- return;
- }
- dojox.gfx.fx.animateFill({
- shape: shape,
- duration: DURATION,
- easing: EASING,
- color: {start: color, end: hl(color)}
- }).play();
- dojox.gfx.fx.animateStroke({
- shape: shape,
- duration: DURATION,
- color: {end: "yellow"},
- width: {end: 2},
- join: {values: ["miter", "bevel", "round"]}
- }).play();
- }
- });
- })();
|