Using Coastline Class

Jul 22, 2010 at 10:20 PM

Hi!, i´m trying to use coastline class, but i i don´t know how to connect this class with ChartPlotter class ...

i´m writing something like ...

    public partial class MainWindow : Window
    {

        ChartPlotter _chart;
        Coastline _coast;
        
        public MainWindow()
        {
            _coast = new Coastline("D:\\Samples\\DynamicDataDisplay v0.3 Source\\src\\Samples\\v0.3\\CoastlineSampleApp\\Coastline.txt"); // create new object & loading points from file
            _chart = new ChartPlotter(); // create new chart
            _coast.AddToPlotter(_chart); // ¿is this the way?          
            this.AddChild(_chart);  // adding chart to window           


            InitializeComponent();                   

        }

    }


At the end, i only get the chart, but the points are not drawn.

<object id="tts_flash" width="18" height="18" type="application/x-shockwave-flash" data="http://www.gstatic.com/translate/sound_player2.swf"> <param name="movie" value="http://www.gstatic.com/translate/sound_player2.swf" /> <param name="flashvars" value="sound_name=&sound_name_cb=_TTSSoundFile" /> <param name="wmode" value="transparent" /> <param name="allowScriptAccess" value="always" /> </object>
Any suggestions??
Thanks!

???

 

 

Jul 22, 2010 at 10:41 PM

I haven't used the Coastline object but in general you need to add an element to the plotters children collection before it is shown in the chart.

  public partial class MainWindow : Window
    {

        ChartPlotter _chart;
        Coastline _coast;
        
        public MainWindow()
        {
            _coast = new Coastline("D:\\Samples\\DynamicDataDisplay v0.3 Source\\src\\Samples\\v0.3\\CoastlineSampleApp\\Coastline.txt"); // create new object & loading points from file
            _chart = new ChartPlotter(); // create new chart
            _chart.Children.Add(_coast);  // Add coastline to chart
            this.AddChild(_chart);  // adding chart to window            


            InitializeComponent();                    

        }

    }


Grant.

 

 

Jul 23, 2010 at 6:07 PM

thanks in advance for your answer ... but it does not seem to work!!!

i have the same result.

i will keep on trying ... but ... any suggestion?

Jul 24, 2010 at 12:04 PM

well ... it works now!!

i have to especify the visible area ... then the code "complete" will be ...

  public partial class MainWindow : Window
{

ChartPlotter _chart;
Coastline _coast;

public MainWindow()
{
_coast = new Coastline("D:\\Samples\\DynamicDataDisplay v0.3 Source\\src\\Samples\\v0.3\\CoastlineSampleApp\\Coastline.txt"); // create new object & loading points from file
_chart = new ChartPlotter(); // create new chart
_chart.Children.Add(_coast); // Add coastline to chart
_chart.Viewport.Visible = new Rect(-50, -50, 100, 100); // for example ...
this.AddChild(_chart); // adding chart to window

InitializeComponent();

}

}

Thanks for your help!!!