1 Reply Latest reply: Sep 26, 2017 4:20 PM by Vishnu Chakravaram RSS

    Creating a multline x axis in a bar chart

    Craig Greenwood

      Hi, I am creating a chart to show survey results.  Each question on the survey is varying in in length from 50-200 characters.  When I create the chart many of the questions are too long to display.  So I have created a method to split the lines dynamically.  Below is my code followed by the problem I'm facing:

       

      =if(len(QuestionTXT) < 50, //if the length is more than 50...

      left(QuestionTXT,round(len(QuestionTXT)/2))

      & chr(13) &

      right(QuestionTXT, round(len(QuestionTXT)/2)), //then split it into two lines

       

      left(QuestionTXT,round(len(QuestionTXT)/3)-1)

      & chr(13) &

      mid(QuestionTXT,round(len(QuestionTXT)/3),round(len(QuestionTXT)/3))

      & chr(13) &

      right(QuestionTXT, round(len(QuestionTXT)/3))) //otherwise split it into three lines

       

      This is working but with some burps.  I think because of the rounding function its giving some mixed results.

       

      One two line question looks like this:

      "I can use R to
      o work with the data"

       

      The full question is "I can use R to work with the data"

       

      Another prints out:

      "I can effectively
      profile a dataset to un
      rstand its limitations"

       

      For that one the full question is ""I can effectively profile a dataset to understand its limitations" (notice its missing "de")

       

      I'd love some tips to tighten this up and make it more humanely readable.

       

      Thanks!