Does ChartDirector.NET support .NET 5.0 (at least on Windows) yet?
Or do you have any working .NET 5.0 sample projects?
We're long term users of ChartDirector v6.0 under .NET Framework 4.x.
I ported our existing component that generates chart images (via ChartDirector) to .NET 5.0 (and ChartDirector to v6.4) but always get black plot area - I've tried several different chart types. I don't get an error as such and you can see from the attached (net50chart.png) that it is does generate the axis labels / key. The same chart generated using ChartDirector v6.4 under .NET Framework 4.8 is also attached (net50chart.png).
I thought it might be to do with dependency on System.Drawing.Common - I tried installing / referencing the v4.5 package of that (and its dependencies) but to no avail.
Feels like I'm close, but I'm obviously missing something.
.NET 5 is the latest version of .NET Core. In the ChartDirector for .NET distribution, there are sample code for .NET Core, like "ChartDirectorNetCoreWinCharts" and "ChartDirectorNetCoreWPFCharts". In the sample code, you can use "Project/Properties" to select the .NET version. If you have installed .NET 5.0, Visual Studio should allow you to change the target to .NET 5.0, and the project should compile and run normally.
Please try to compile and run the .NET Core sample code to check if you can see the charts.
For your own project, to use ChartDirector for .NET in a .NET 5.0 or .NET Core, you would need to include the ChartDirector.Net.Desktop.Controls nuget package in your project:
If the sample code works normally, but in your own project the chart is just a black rectangle, is it possible to create a simple project that can illustrate the problem? For example, you can create a project with a single Form and a single WinChartViewer, and use the "Simple Bar Chart" sample code to create a simple bar chart. If you can create a project that can reproduce the problem, please zip the entire Visual Studio solution and email to me at firstname.lastname@example.org.
I am thinking, the chart is not entirely black. At least it can display the text. Is it possible the colors in your chart is set up incorrectly? For testing, it is better to hard coded colors, and not using variables. If you allow the user to enter a color, your code would need to convert the user inputs into the color format used by ChartDirector (which is 0xAARRGGBB, where AA=0 means opaque, and AA=FF means totally transparent). If the conversion encounters problems, it may just return 0, which is the black color. For example, if int.TryParseInt is used for the conversion, it will silently set the output to 0 if there is any error, without throwing any exception.
Thanks for your support - helpful, very efficient and much appreciated.
Yes it turned out that my routine to convert a hex colour string to ChartDirector colour compatible integer hadn't correctly survived the port to .NET 5.0 and was returning 0 for all colours - hence black chart.
Fixing that (with Convert.ToInt32(Replace(strColour, "#", "0x"), 16) did the trick.
Thanks again - now have .NET 5.0 web api method returning dynamic images as I'd hoped - superb product.