X Axis Tick Handling / Labeling

Aug 10, 2011 at 6:56 PM

I have a list of week start dates, i.e. 7/4/2011 7/11/2011 etc., and want to display a graph who's x-axis ticks are limited to the number of elements I pass in.

So, if I have a list of 5 weeks, I want to display 5 ticks at appropriately spaced intervals (it is safe to assume that every week list will be sequential.)

My XAML layout is as follows:

<Grid>
        <d3:ChartPlotter Name="plotter" Margin="10,10,20,10">
            <d3:ChartPlotter.HorizontalAxis>
                <d3:HorizontalDateTimeAxis Name="dateAxis"/>
            </d3:ChartPlotter.HorizontalAxis>
            <d3:ChartPlotter.VerticalAxis>
                <d3:VerticalIntegerAxis Name="countAxis"/>
            </d3:ChartPlotter.VerticalAxis>

            <d3:Header FontFamily="Arial" Content="Plot"/>
            <d3:VerticalAxisTitle FontFamily="Arial" Content="Remaining ToDo"/>
            <d3:HorizontalAxisTitle FontFamily="Arial" Content="Weeks"/>
        </d3:ChartPlotter>
    </Grid>

Additionally it would be nice, and somewhat essential, that I am able to label each tick with its corresponding date.

I am completely fine with using a static graph, if that is the only way to do this in any reasonable time frame.

 

Is any/all of this possible? If so, where should I start looking? 

Aug 30, 2011 at 3:34 PM

Hi conradtj, I'm looking for the same thing, basically how can we set the interval, max and min, and grid properties of axis??, did you find the anser?

thx

Oct 7, 2011 at 5:14 AM

Hi,

Use something like this.

 this.dateAxis.LabelProvider.SetCustomFormatter(
                        info => info.Tick.ToString(
                            "dd" +
                            CultureInfo.CurrentCulture.DateTimeFormat.DateSeparator +
                            CultureInfo.CurrentCulture.DateTimeFormat.LongTimePattern,
                            CultureInfo.CurrentCulture));

Regards

Ravi.