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

Message ListMessage List     Post MessagePost Message

  Different position for titles and labels in Win7 and Win10
Posted by Erkki Holttinen on Nov-29-2016 17:58
Attachments:
Noticed that titles and labels are getting different vertical position when creating the chart with Windows 7 in comparison to Windows 10 machine. When created with Windows 7 the text location is 1 pixel higher that where it is on Windows 10.

Sample code to reproduce this:
XYChart c = new XYChart(260, 60);
c.getDrawArea().rect(100, 3, 160, 18, 0, 0xFFFFFF);
c.addTitle(8, "Title");

The rectangle is added to clarify the difference. Attached an image in which upper chart is generated with Windows 7 and lower is with Windows 10.
The same seems to occur for all texts drawn on the chart. In case text is rotated by 45 degrees, then the position is the same. When rotated by 90 degrees, the difference becomes horizontal.

Used ChartDirector version is 5.1.
Is there anything I can do to get the text locations to be the same on both OS versions without having to adjust the text location by adjusting yOffset OS dependently?
titles.png

  Re: Different position for titles and labels in Win7 and Win10
Posted by Administrator on Nov-29-2016 18:32
Hi Erkki,

Please download the latest version of ChartDirector for .NET to solve this problem.

The issue is due to .NET itself reporting the bounding box differently in Windows 7 and Windows 10. If you use pure .NET code (not using ChartDirector) to draw one line of short text (eg. using Graphics.DrawString), and then ask .NET for the bounding box (eg. using Graphics.MeasureCharacterRanges), the bounding boxes reported in Windows 7 and Windows 10 may differ vertically by 1 pixel. This depends on the font style and size and occurs in around 80% of the cases.

ChartDirector 5.1 was released before Windows 10. It just uses the bounding box as reported by .NET, and this causes the 1 pixel difference you see.

In the latest version of ChartDirector, we have special code to make sure the bounding box is consistent for different versions of Windows.

Hope this can help.

Regards
Peter Kwan

  Re: Different position for titles and labels in Win7 and Win10
Posted by Erkki Holttinen on Nov-29-2016 18:58
Hi Peter,

Thank you for the quick response. Will try with newer version.

-Erkki

  Re: Different position for titles and labels in Win7 and Win10
Posted by Erkki Holttinen on Nov-30-2016 14:55
Hi Peter,

Confirmed that this has been fixed in 6.1.1.0 version.
Unfortunate for us is the framework requirement of that version, since we are currently forced to stay on .NET Framework 3.5. Any change that this fix could be applied to a version compatible with the older .NET Framework?

-Erkki

  Re: Different position for titles and labels in Win7 and Win10
Posted by Administrator on Nov-30-2016 23:34
Hi Erkki,

Because of the need to support ASP.NET MVC 4, the latest version of ChartDirector for .NET requires .NET 4.0 or above. The .NET 4.0 is old enough to support XP and Windows 2003, while new enough to support ASP.NET MVC 4.

For your case, I have asked our developers to try to remove the ASP.NET MVC features from ChartDirector can compile another version targeting .NET 2.0. The resulting ChartDirector should work with .NET 2.0 or above. You may download the DLLs below:

http://www.advsofteng.com/netchartdir601.zip

The above includes both strong-named and non-strong-named versions of "netchartdir.dll". Please use the one that fit you needs.

Hope this can help.

Regards
Peter Kwan

  Re: Different position for titles and labels in Win7 and Win10
Posted by Erkki Holttinen on Dec-05-2016 13:50
Hi Peter,

Checked the provided binaries and they are working as expected. Thank you for quick resolution to this problem.

-Erkki