Menu

help with lables

2009-09-07
2012-09-07
  • Kyle Giovannetti

    ok so first time user, had it working in no time :)

    what i am plotting is time based data of users active on a service. this works great. the Y axis labels directly on the tick marks, which is what i want, but i would like the x axis to do the same, the x axis labels on every data point, i am plotting a lot of data so its just all black under the plot from where its jammed 300 labels together. i have read through the manual but cant figure out how to set it to only label on the grid marks.

    im sure it is probably a simple answer.

    thanks for your help
    kyle

     
    • Kyle Giovannetti

      perfect, thank you very much works like a charm

       
    • Alex Doll

      Alex Doll - 2009-09-07

      Couple of things to try:

      1. $plot->SetXTickIncrement( some number);
        http://phplot.sourceforge.net/phplotdocs/SetXTickIncrement.html

      2. Set the plot to data-data rather than text-data chart:
        $plot->SetDataType('data-data');
        http://phplot.sourceforge.net/phplotdocs/SetDataType.html

       
    • Kyle Giovannetti

      i got it closer to what i want, by using

      $plot->SetXDataLabelPos('none');
      $plot->SetXLabelType('time');
      $plot->SetXTimeFormat('%d %b %Y');

      my X data is in UNIX time, so my X data is like 1251932930 which is Wed, 02 Sep 2009 23:08:50 GMT

      as you can see i've set my X label type to time, and specified a format, the dates it is giving me are from the beginning of unix time however (time 0 in unix time). if i don't label in time then it marks the ticks as like 10, 20, 30 ... the number of the data point, i want it to label as the x value at that point (similar to how the Y axis does it) so the values would be like '1251932930' or if i set the x axis type to date it would give me the proper date. can someone tell me how to label the X axis based on the X value at that data point and not the position of that data point.

      thanks

       
    • Kyle Giovannetti

      sorry i replied before seeing your response, when i set to data-data i get no plot, it still labels the X axis as before (year 1969), looking in the documentation i see data format should be
      array(' ', 2, 15), im using a sql query to populate the data so my data type is array(2, 15) could that be causing the problem?

      thanks

       
      • Alex Doll

        Alex Doll - 2009-09-07

        Try getting your SQL query to add the extra space for you:

        SELECT '' AS 'emptylabel', firstfield AS 'Xdata', secondfield AS 'Ydata' FROM ...

        The column names aren't necessary, but they do tell you what belongs where.

         

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.