Andreas Posted December 14, 2021 Report Share Posted December 14, 2021 HI I have a problem, I don't know how to write a script that will allow me, for example, to display the highest values in a given know and column in a specific font and background color so at it loocks like in MS Excel sales raport Example show the highest values in row 5 and column 3 in a green yellow background show the lowest values in line 6 and column 2 in red, pink background Also, if the value is greater than 0, or any given value for a specific row and column, use blue etc. I use this code in a footer to show negative values in a color for example red <SCRIPT LANGUAGE="JavaScript"> var elems = document.getElementsByTagName("td"); for (var i=0, m=elems.length; i<m; i++) { if (elems[i].innerHTML.charAt(0) == "-") { elems[i].style.color="red"; elems[i].style.backgroundColor="#fde8f3"; } } </SCRIPT> I would like to get such an effect under the graph Quote Link to comment Share on other sites More sharing options...
Kurumi Posted December 24, 2021 Report Share Posted December 24, 2021 Hi @Andreas - do you have a screenshot of your sample DataPage? Quote Link to comment Share on other sites More sharing options...
Andreas Posted December 29, 2021 Author Report Share Posted December 29, 2021 HI. Thank you for your interest. I can change the color of negative and positive values using JavaScript, but I can not write a script that would allow me to change the correlation of the highest and lowest value in the report to show the decrease and increase in the percentage of sales compared to the previous period. Best Regards Java example: <SCRIPT LANGUAGE="JavaScript"> var elems = document.getElementsByTagName("td"); for (var i=0, m=elems.length; i<m; i++) { if (elems[i].innerHTML.charAt(0) == "-") { elems[i].style.color="red"; elems[i].style.backgroundColor="#fde8f3"; } } </SCRIPT> <SCRIPT LANGUAGE="JavaScript"> var elems = document.getElementsByTagName("td"); for (var i=0, m=elems.length; i<m; i++) { if (elems[i].innerHTML.charAt(0) == "-") { elems[i].style.color="red"; elems[i].style.backgroundColor="wgite"; } if (elems[i].innerHTML.charAt(0) !== "-" && elems[i].innerHTML.indexOf("%") !== -1) { elems[i].style.color="green"; elems[i].style.backgroundColor="#c7ffc3"; } } </SCRIPT> Quote Link to comment Share on other sites More sharing options...
Andreas Posted December 29, 2021 Author Report Share Posted December 29, 2021 The graph in Ajax does not work together to display negative values in red, for example Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.