dbTalk Databases Forums  

Problems with charting - solution

microsoft.public.sqlserver.olap microsoft.public.sqlserver.olap


Discuss Problems with charting - solution in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
apofis1@tlen.pl
 
Posts: n/a

Default Problems with charting - solution - 09-01-2006 , 07:20 AM






Hi

I've been testing new version of CellSetGrid control and I've noticed
that sometimes the scaling of histogram's red-rectangles is not
correct..

First of all the sum of all values (Member: "All") is almost always a
huge value so it shouldn't be displayed in my opinion

Original part of code:

else if (IsHistogram)
{
td.className = "Histo";

var iLength = Math.max(1, Math.abs( c.V * 100
));

if ( c.V >= 0 ) td.innerHTML = "<span
style=\"width:" + iLength + "px;\"></span>" ;
else td.innerHTML = "<span class=neg
style=\"width:" + iLength + "px;\"></span>";

}

My improvemnt is first to change all commas in (c.V) values to dots;
next do not include "All" member values in histogram and finally scale
the rest of rectangles' lengths to each other..

New version of code:

else if (IsHistogram)
{
td.className = "Histo";

var strValue = c.V;
var stringToReplace = /,/g;
// replace "," with "."
var result = str.replace(stringToReplace ,".");
var resultNumber = result * 148; // 148 is good
width of cell.. I use proportion
var iLength = Math.round( len );

if (c.V == 1){ // do not display rectangle for
"All" member
td.innerHTML = "<span style=\"width:" + 0 +
"px;\"></span>";
}
else{

if (iLength > 0){
td.innerHTML = "<span style=\"width:" +
iLength + "px;\"></span>";
}
else
{
td.innerHTML = "<span style=\"width:" +
0 + "px;\"></span>";
}
}

}

Thanks 4 great control..
Apofis


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.