Manipulation of an array

Discussion in 'PHP' started by yoda69, Mar 10, 2012.

  1. #1
    Hey all,
    I'm using an array to populate labels for a graph. When I have a lot of keys in the array (user answered a questionnaire many times) there are too many labels in graph and it does not look good.
    I want to limit the number of key in the array to 15.
    Do you have any ideas about good ways to manipulate the array but leaving the 1'st and last values, and choosing interval keys between them?

    Or do you think it will be simpler to do this on mysql level?
    Thanks,
     
    yoda69, Mar 10, 2012 IP
  2. sarahk

    sarahk iTamer Staff

    Messages:
    28,899
    Likes Received:
    4,555
    Best Answers:
    123
    Trophy Points:
    665
    #2
    I'd recommend designing how you want your graph to look and THEN thinking about how to configure the data. Personally, I'd manipulate at the php script level and leave the javascript to generate the graph.

    Stepping back a bit... its usually a good idea to think about how the data will be displayed when you are planning the questionnaire as this may make you take an alternative approach with the questions.
     
    sarahk, Mar 10, 2012 IP