Page 1 of 1

tChart.Draw in WPF v4 version

Posted: Wed Jan 02, 2013 5:13 am
by 15662757
We are migrating from V3 to WPF V4 version and having issues with tChart.Draw method. in v3, it used to be a simple .Draw call, but in WPF v4, it needs a Media.DrawingContext. How do I get a drawingContext for my tChart object so that I can pass it to this method?


Any sample code will be of great help.

Thanks

Re: tChart.Draw in WPF v4 version

Posted: Wed Jan 02, 2013 1:24 pm
by 10050769
Hello asupriya,

If you use TeeChartFor.Net WPF version you can achieve the same functionalities as TeeChartFor.Net, but you need know you are working in different canvas and is possible some methods as you have in TeeChartFor.Net there aren't in TeeChartFor.Net WPF, this doesn't mean you don't achieve the same result using other methods. Therefore, if you use TeeChartFor.Net WPF and you want achieve redraw the chart as does method TChart1.Draw() of TeeChartFor.Net you can use tChart1.Chart.Bitmap() method as do in next lines of code:

Code: Select all

public MainWindow()
        {
            InitializeComponent();
            InitializeChart();
        }
  
        Steema.TeeChart.WPF.Styles.Line Series1;
        private void InitializeChart()
        {
            Series1 = new Steema.TeeChart.WPF.Styles.Line(tChart1.Chart);
            Series1.FillSampleValues();
            tChart1.AfterDraw += new Steema.TeeChart.WPF.PaintChartEventHandler(tChart1_AfterDraw);
            BitmapSource bmp = tChart1.Chart.Bitmap(tChart1.Width,tChart1.Height);
        }

        void tChart1_AfterDraw(object sender, Steema.TeeChart.WPF.Drawing.Graphics3D g)
        {
            tChart1.Panel.MarginBottom = 15;
        }
I hope will helps.

Thanks,