ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  7.1 XYChart makeImage method missing
Posted by David S on Jun-13-2023 20:51
Just upgraded to 7.1 (ChartDirector.net nuget package) and any references I have to using the makeImage() method from a XYChart object are no longer valid.  Documentation shows this method is still available.  Just checking to see if this is a bug, or if I am missing something.  Thanks.

  Re: 7.1 XYChart makeImage method missing
Posted by Peter Kwan on Jun-13-2023 22:58
Attachments:
Hi David S,

Are your project targetting .NET 5 or later and also targeting non-Windows OS?

Note that if your project type can support both Windows and non-Windows OS (such as ASP.NET MVC), and you have not configured the target OS, Visual Studio will assume it targets all supported OS, which includes Windows and non-Windows OS (eg. Linux, macOS). If your intention is to target Windows only, please configure the target OS to Windows. I have attached a VS 2022 screen shot for your reference.

Note that Microsoft has discontinued the entire System.Drawing.* (including System.Drawing.Image) in all supported .NET versions. (Currently, Microsoft only supports .NET 6 or later. Earlier .NET versions are all "end of support".)

See:

https://learn.microsoft.com/en-us/dotnet/core/compatibility/core-libraries/6.0/system-drawing-common-windows-only

So in any case, non-Windows projects should not use System.Drawing.*, as it cannot work in all supported .NET versions.

That is the reason why we need to release ChartDirector 7.1. It is to remove "System.Drawing.*" for non-Windows targets, so it can be compatible with newer and supported .NET versions.

From experience, non-Windows projects should not need to use System.Drawing.Image, as it is a very Windows specific type (eg. it uses GDI handles in the Image.FromHbitmap method). It is normally only used in Windows only project types, like Windows Forms and WPF. If you are writing a web project and you need to create images, ChartDirector can create various types of images directly by using BaseChart.makeChart and BaseChart.makeChart2. See:

https://www.advsofteng.com/doc/cdnet.htm#BaseChart.makeChart.htm
https://www.advsofteng.com/doc/cdnet.htm#BaseChart.makeChart2.htm

Regards
Peter Kwan
devenv_target_win.png

  Re: 7.1 XYChart makeImage method missing
Posted by David S on Jun-14-2023 00:11
Thanks Peter.  Yes, that makes sense.  Thank you for your time.