Timeline with variable length shapes

Feb 1, 2010 at 4:17 PM


I am new to D3 and trying to create a graph that contains a time line (time along x axes) with variable time duration shapes.  The concept is similar to candlestick chart sample with the exception that samples are varied across the time axes (x) instead of y axes (double).  From what I can understand, there is no way to specify the sample length in terms of time span along the x-axes even though the x-axes is DateTime.  So, does it mean that I need to use the logic similar to this:

                                <MultiBinding Converter="{StaticResource widthConverter}">
                                    <Binding Path="StartTime"/>
                                    <Binding Path="EndTime"/>

where StartTime and EndTime is the duration of the actual samples.  The widthConverter will use the TimeToDouble conversion with parameters identical to the ones passed into SetConvertion method on the Plotter.  So both the start and end times are converted to double and then the difference is passed into ViewportWidth property.  Is this the right way of doing this?

It seems like it does work, however, my samples (i am drawing rectanges) seem to be centered around the StartTime (Viewport.X is bound to StartTime).  How can I make the sample rectangle start at EXACTLY the StartTime value and extend for the duration of the sample?