thepip3r Posted November 13, 2009 Share Posted November 13, 2009 so i'm writing a wrote a page that displays a graph: http://www.zigsdigs.com/trigeo/graphDisplay.php all you'll see is the default values, not actual data because no form was submitted. BUT, here you can kind of see my problem. i'm writing the actual number values on top of the graph points. but sometimes, the lines overwrite the word or the points are too close on the chart that they overlap each other. i'm not asking for code... just an idea on how to go about fixing this issue? i was thinking about possibly trying to figure out a calculation for overlap using point-to-point slope with some calc to see if a point would lie on a line, x,y coord with strlen to see the total space taken up by a text image, etc. can anyone describe a better way ?? TIA! Link to comment https://forums.phpfreaks.com/topic/181417-php-graphing-faint-hearted-how-to-determine-overlaps-and-overcome-them/ Share on other sites More sharing options...
lemmin Posted November 13, 2009 Share Posted November 13, 2009 I just see a bunch of broken images when I click the link. Link to comment https://forums.phpfreaks.com/topic/181417-php-graphing-faint-hearted-how-to-determine-overlaps-and-overcome-them/#findComment-957011 Share on other sites More sharing options...
thepip3r Posted November 13, 2009 Author Share Posted November 13, 2009 my apologies... i've been actively troubleshooting since the post so i'm echoing out values as well... try it now. Link to comment https://forums.phpfreaks.com/topic/181417-php-graphing-faint-hearted-how-to-determine-overlaps-and-overcome-them/#findComment-957052 Share on other sites More sharing options...
lemmin Posted November 13, 2009 Share Posted November 13, 2009 One thing you can do is check the slope of the next line you are going to draw. If the next line is going to go upwards, place the text underneath the dot. Inversely, if it is going to go downwards, place the text above the dot. (If the slope is zero you probably want to put it on the opposite side than the previous one.) Also, since it is a graph, the previous line is always going to be on the left side so you might also want to offset the number to the right slightly. As for them being too close together; there should always be a static horizontal distance between them all shouldn't there? Link to comment https://forums.phpfreaks.com/topic/181417-php-graphing-faint-hearted-how-to-determine-overlaps-and-overcome-them/#findComment-957064 Share on other sites More sharing options...
thepip3r Posted November 13, 2009 Author Share Posted November 13, 2009 yes and there is... but it is not so static as it is based off of a calculation of the number of points to be placed on the graph... maybe i should include some "minimum distance" or something along that order. ty for the very simplistic logic on how to orient the texts. greatly appreciated. Link to comment https://forums.phpfreaks.com/topic/181417-php-graphing-faint-hearted-how-to-determine-overlaps-and-overcome-them/#findComment-957073 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.