Re: [Flashcoders] Algorithm for distributing labels along a timeline without overlapping
spring embedder layout might work. http://wwwteo.informatik.uni-rostock.de/~le/Lehre/SS04/GraphLayout/demo3.ht ml All, [Sorry if this is a repost... some email issues today...] Hope I can phrase this question clearly... I'm working on an application that will display a visual timeline with a vertical orientation. At various points along the timeline, it will display key markers/milestones. Each one of these markers will have a label. The problem arises when several milestones are bunched together. If I draw the label for each marker at the exact y coordinate that corresponds with that particular point in time, the labels will overlap, and are unreadable. One obvious solution is to stack the labels horizontally, but because of the particular layout of this application, that's not possible. So, what I need is an algorithm that will nudge the Y coordinate of various labels just enough to get everything to fit. Then, I'll draw a hairline from the label to the exact Y coordinate on the timeline that it's associated with. I could start with the top label, and then step through each label below, moving them each down enough to remove overlaps. But that could result in a lot more moving than necessary, and won't use space optimally. A better solution would be one that moves some up, some down, to minimize the total distance. Here's an exact example of what I'm trying to accomplish: http://www.smartmoney.com/fundanalyzer/ Is anyone aware of an algorithm that does something like this? Many thanks in advance for any insights or advice! Cheers, Matt ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] Algorithm for distributing labels along a timeline without overlapping
All, Hope I can phrase this question clearly... I'm working on an application that will display a visual timeline with a vertical orientation. At various points along the timeline, it will display key markers/milestones. Each one of these markers will have a label. The problem arises when several milestones are bunched together. If I draw the label for each marker at the exact y coordinate that corresponds with that particular point in time, the labels will overlap, and are unreadable. One obvious solution is to stack the labels horizontally, but because of the particular layout of this application, that's not possible. So, what I need is an algorithm that will nudge the Y coordinate of various labels just enough to get everything to fit. Then, I'll draw a hairline from the label to the exact Y coordinate on the timeline that it's associated with. I could start with the top label, and then step through each label below, moving them each down enough to remove overlaps. But that could result in a lot more moving than necessary, and won't use space optimally. A better solution would be one that moves some up, some down, to minimize the total distance. Here's an exact example of what I'm trying to accomplish: http://www.smartmoney.com/fundanalyzer/ Is anyone aware of an algorithm that does something like this? Many thanks in advance for any insights or advice! Cheers, Matt ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] Algorithm for distributing labels along a timeline without overlapping
All, [Sorry if this is a repost... some email issues today...] Hope I can phrase this question clearly... I'm working on an application that will display a visual timeline with a vertical orientation. At various points along the timeline, it will display key markers/milestones. Each one of these markers will have a label. The problem arises when several milestones are bunched together. If I draw the label for each marker at the exact y coordinate that corresponds with that particular point in time, the labels will overlap, and are unreadable. One obvious solution is to stack the labels horizontally, but because of the particular layout of this application, that's not possible. So, what I need is an algorithm that will nudge the Y coordinate of various labels just enough to get everything to fit. Then, I'll draw a hairline from the label to the exact Y coordinate on the timeline that it's associated with. I could start with the top label, and then step through each label below, moving them each down enough to remove overlaps. But that could result in a lot more moving than necessary, and won't use space optimally. A better solution would be one that moves some up, some down, to minimize the total distance. Here's an exact example of what I'm trying to accomplish: http://www.smartmoney.com/fundanalyzer/ Is anyone aware of an algorithm that does something like this? Many thanks in advance for any insights or advice! Cheers, Matt ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Algorithm for distributing labels along a timeline without overlapping
Check the height vs. y pos of the first and evenly distribute. Something like 'total with in range' x 'height' and then iterate position via start y -= totalHeight/2. rough idea but some where to start. B. On Fri, Jan 16, 2009 at 1:17 PM, matt stuehler stuehler.t...@gmail.comwrote: All, Hope I can phrase this question clearly... I'm working on an application that will display a visual timeline with a vertical orientation. At various points along the timeline, it will display key markers/milestones. Each one of these markers will have a label. The problem arises when several milestones are bunched together. If I draw the label for each marker at the exact y coordinate that corresponds with that particular point in time, the labels will overlap, and are unreadable. One obvious solution is to stack the labels horizontally, but because of the particular layout of this application, that's not possible. So, what I need is an algorithm that will nudge the Y coordinate of various labels just enough to get everything to fit. Then, I'll draw a hairline from the label to the exact Y coordinate on the timeline that it's associated with. I could start with the top label, and then step through each label below, moving them each down enough to remove overlaps. But that could result in a lot more moving than necessary, and won't use space optimally. A better solution would be one that moves some up, some down, to minimize the total distance. Here's an exact example of what I'm trying to accomplish: http://www.smartmoney.com/fundanalyzer/ Is anyone aware of an algorithm that does something like this? Many thanks in advance for any insights or advice! Cheers, Matt ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders