Menu

Display X columns for only non-empty data

2013-08-13
2013-08-13
  • j_allen_morris

    j_allen_morris - 2013-08-13

    I'm using the Candlestick feature to plot Forex currency candlesticks. In the 4-hour time frame, my chart of 20 candles almost always includes weekend data on the X-axis but there is no data on the weekends. This creates a gap in my data. Is there a way that I can tell PHPlot to not create a space on the X-axis when there is no data to graph there?

    Here is a screen capture of what I'm talking about:

    How do I get rid of that huge gap in the middle and have X-axis space for points with data?

    Jarod

     
  • lbayuk

    lbayuk - 2013-08-13

    You could try using 'text-data' instead of 'data-data' data type for your data array. This makes the X values 'implied', so each row of your data array is a new data point, the same X distance from the previous point. This will get rid of the gaps. I'm not sure how that would work for you, though.

    The date/time labels you have now (X values) would need to become data labels, in your data array. Unless you want every point labeled, you would need to leave some of them blank, and only label certain rows of your data array (every Nth row, or every row that starts a new day, are two possibilities).

    I haven't actually tried it, but it might work.

     
  • j_allen_morris

    j_allen_morris - 2013-08-13

    Thanks lbayuk, it worked! I changed it to text-data and then had to alter my $data[] array so it had 5 items from the row, 1) Date 2) Open 3) High 4) Low 5) Close. Works awesome! Thanks.

     

Log in to post a comment.