Graphics

 View Only
  • 1.  Display Data into a percentage

    Posted 08-05-2022 22:46
      |   view attached
    Setting up Election graphics to display vote percentage from an excel spread sheet. Xpression is showing the voters percent column as decimals. Is there a way in visual logic to display nice whole percentage numbers?

    ------------------------------
    Tina Ludewig
    Graphic Artist
    KITV4 Island Television
    ------------------------------


  • 2.  RE: Display Data into a percentage

    Posted 08-07-2022 17:55
    You can either use visual logic or you can use a script.  In visual logic you would just take your data block and then use a multiply block and do *100.  In the same way you could write a script that would get your text and make it into a number and then multiply that by 100 as well, and then save it out to a new text box.

    ------------------------------
    Garrett Hall
    Overtime Elite
    ------------------------------



  • 3.  RE: Display Data into a percentage

    Ross Staff
    Posted 08-08-2022 04:26
    You can multiple the number and then use a round or trunc block to remove the numbers after the decimal.

    ------------------------------
    Simon Redmile
    Senior Graphic Programmer & Designer
    Ross Video
    Bristol United Kingdom
    ------------------------------



  • 4.  RE: Display Data into a percentage

    Posted 08-11-2022 09:49

    EDIT: nm, i realized that the most appropriate thing is to just round each percentage.

    I have a side question here. I hope it is ok to ask here as it is not really an Xpression software question, but more of an Elections show and general algorithm/logic question. I could ask this on Stackoverflow, but they are jerks. Haha! I'm curious what is the best practice here with calculating percentages. In my case, the state's data will give us the vote count of each candidate. It is up to me to figure out percentages. Now, I image that rounding to some very small decimal point then truncating to the percentage point will be the most accurate, but it seems in my mind that no matter what I choose,  rounding or truncating or any combination of both, it could leave results that don't add up to 100%. Am I right to assume this? Right now, I'm pursuing this solution that rounds to a small decimal point and then truncates for the percentage for the results for all the candidates but the last candidate/write-in. The final candidate/write-in I just add up the other percentages and subtract that from 100, so it adds up to 100% every time. I get that I'm probably being overly meticulous about this, but I take my responsibility here to give the public accurate results quite seriously. If anybody has any advice, I'd appreciate it.



    ------------------------------
    Roger Heyward
    ------------------------------