This project is read-only.

Vertical axis labels overridden by ticks after adding line graph

Nov 8, 2011 at 7:43 AM
Edited Nov 8, 2011 at 8:03 AM

Hi all,

Very very nice chart mechanism, simple and does the job.

I'm having a problem with the labels of the vertical axis. I am creating a line graph by removing all LineGraphs and MarkerPointGraphs from the plotter's children, then creating a line chart, and calling FitToView (to show the graph).

for some unknown reason, the ticks of the vertical axis move to the left thus hiding the labels when I call the function again, the ticks go back to their good position, again, they hide and so forth, it is not consistent, sometimes for a few times the ticks stay ok, and then they hide the label for some iterations. very frustrating since I am doing the exact same thing over and over, and getting different results.

I'm using windows 7, 64bit if it matters...

below is my code behind function to draw a line (called when I left click on the graph) and the XAML that created the chart.

code behind:

private void DrawLine()
            List<IPlotterElement> removeList = new List<IPlotterElement>();
            foreach (var item in plotter.Children)
                if (item is LineGraph || item is MarkerPointsGraph)
            foreach (var item in removeList)
            List<DateTime> dt = new List<DateTime>();
            List<int> values = new List<int>();
            for (int i = 0; i < 100; i++)
                values.Add(i * 2);
            var datesDataSource = new EnumerableDataSource<DateTime>(dt);
            datesDataSource.SetXMapping(x => xAxis.ConvertToDouble(x));

            var valuesDataSource = new EnumerableDataSource<int>(values);
            valuesDataSource.SetYMapping(y => y);

            CompositeDataSource compositeDataSource = new CompositeDataSource(datesDataSource, valuesDataSource);
                     new Pen(Brushes.Green, 2),
                     new CirclePointMarker { Size = 6.0, Pen = new Pen(Brushes.Black, 1.0), Fill = Brushes.LightGreen},
                     new PenDescription("Data"));

            header.Content = DateTime.Now.ToShortTimeString();
            yAxisTitle.Content = DateTime.Now.ToShortTimeString();
            xAxisTitle.Content = DateTime.Now.ToShortTimeString();




<Window x:Class="DynamicDataDisplayChart.MainWindow"
        Title="MainWindow" Height="350" Width="525">
        <d3:ChartPlotter Name="plotter" Margin="10,10,20,10">
            <d3:Header Name="header" FontFamily="Arial" Content="Bug Information"/>
            <d3:VerticalAxisTitle Name="yAxisTitle" FontFamily="Arial"/>
            <d3:HorizontalAxisTitle Name="xAxisTitle" FontFamily="Arial"/>
                <d3:HorizontalDateTimeAxis Name="xAxis"/>
                <d3:VerticalIntegerAxis Name="yAxis"/>

Thanks in advance...