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 |