I've tried to embed a .NET WinForms graph (Stephan Zimmermann's Graph Display) in a WPF window, under a WindowsFormsHost (I've referenced both System.Windows.Forms and WindowsFormsIntegration).
However, I can see the form panel but not the graph. I've ran the demo application on a windows form and it worked, but when I transfered the same code to the WPF window, I saw that the data is updated but not shown on the graph.
Thank everyone in advance,
Yaron.
Although the question is more than 6 years old I had a similar (if not the same issue), when trying to create and add the Chart object at runtime. Thanks to Bobwah's suggestion I could isolate the problem and found that I simply had to add a ChartArea to the Chart object to see the graph:
Chart chart = new Chart();
chart.ChartAreas.Add("MainChartArea"); //this was missing
chart.Series.Add(getSeries());
chart.Dock = System.Windows.Forms.DockStyle.Fill;
host.Child = chart; //'host' is the WPF-WindowsFormsHost control
Hope it helps someone... ;)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With