Using RawDataSource - no graph is displayed

May 26, 2010 at 11:18 AM
Edited May 26, 2010 at 11:20 AM
Hello, I am trying to achieve 'rolling graph' (graph is automatically scrolled rather expanded) effect using D3 and its RawDataSource. I use the following code:

void MainWindow_Loaded(object sender, RoutedEventArgs e)
var source = new RawDataSource();
MainChart.AddLineGraph(source, Colors.AliceBlue, 2);
timer = new Timer(FeedData, source, 0, 100);

private void FeedData(object state)
var source = (RawDataSource)state;
var data = new Point[200];
for (int index = 0; index < data.Length; index++)
data[index] = new Point(it, Math.Sin(it));

it += 0.1; //ignore overflow fot this simple example
Action act = () =>
source.Data = new List<Point>(data);

Dispatcher.BeginInvoke(DispatcherPriority.Normal, act);

The graph axes seem to 'oscillate' so the sinusoid is actually being fed as a source but... no graph ever appears, no points are actually shown only axes change (and plot center point)... what am i doing wrong? Is such usage pattern supported at all?
May 26, 2010 at 2:27 PM

See if "src\Samples\Simple\DynamicPointAddSample" provides any help.

David Roh


May 26, 2010 at 4:28 PM

Thank you very much, although it is not 100% what i wanted i think i may adjust it to my needs. Once again thanks for the help. Anyways implementing more 'rolling plot' would be a great feature for D3