Profile Picture

Legend items appear blurry or clipped when rendering to a window

Posted By Lance Levendowski 9 Years Ago

Legend items appear blurry or clipped when rendering to a window

Author
Message
Lance Levendowski
Posted 9 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)

Group: Forum Members
Last Active: Last Year
Posts: 60, Visits: 157
Legend items can appear blurry or clipped when NChartControl.Settings.RenderSurface = window.

Can this be prevented?

Run the following example to reproduce the issue.  Notice that the clipping of text in the legend depends on the size of the NChartControl.

Public Class LegendForm
  Inherits Windows.Forms.Form

  Private _ChartControl1 As Nevron.Chart.WinForm.NChartControl
  Private WithEvents _CheckBox1 As Windows.Forms.CheckBox

  Public Sub New()
    Call InitializeControls()
  End Sub

  Private Sub InitializeControls()
    Me.Size = New Drawing.Size(640, 392)
    Me.StartPosition = FormStartPosition.CenterScreen

    Dim lowResolutionDataSize As New Drawing.Size(20, 20)
    Dim highResolutionDataSize As New Drawing.Size(255, 255)

    Const renderSurface As Nevron.GraphicsCore.RenderSurface = Nevron.GraphicsCore.RenderSurface.Window
    Const shadingMode As Nevron.Chart.ShadingMode = Nevron.Chart.ShadingMode.Smooth
    Const triangulationMode As Nevron.Chart.MeshSurfaceCellTriangulationMode = Nevron.Chart.MeshSurfaceCellTriangulationMode.MaxDiagonal

    Dim chartBounds As New Drawing.Rectangle(0, 0, Me.ClientSize.Width, Me.ClientSize.Height - 24)
    Me._ChartControl1 = Tools.CreateChartControlWithMeshSurface(Me, "Low Res ZoneTexture", chartBounds, True, renderSurface, shadingMode, triangulationMode, lowResolutionDataSize)
    Me._ChartControl1.Anchor = AnchorStyles.Left Or AnchorStyles.Top Or AnchorStyles.Right Or AnchorStyles.Bottom

    Me._CheckBox1 = New Windows.Forms.CheckBox
    Me._CheckBox1.Text = "Render to Window"
    Me._CheckBox1.Location = New Drawing.Point(0, Me._ChartControl1.Bottom)
    Me._CheckBox1.AutoSize = True
    Me._CheckBox1.Anchor = AnchorStyles.Left Or AnchorStyles.Bottom
    Me._CheckBox1.Checked = (Me._ChartControl1.Settings.RenderSurface = Nevron.GraphicsCore.RenderSurface.Window)
    Me.Controls.Add(Me._CheckBox1)
  End Sub

  Private Sub _CheckBox1_CheckedChanged(sender As Object, e As System.EventArgs) Handles _CheckBox1.CheckedChanged
    If (Me._CheckBox1.Checked) Then
      Me._ChartControl1.Settings.RenderSurface = Nevron.GraphicsCore.RenderSurface.Window
    Else
      Me._ChartControl1.Settings.RenderSurface = Nevron.GraphicsCore.RenderSurface.Bitmap
    End If
  End Sub

End Class



Nevron Support
Posted 9 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,437 reputation)Supreme Being (4,437 reputation)Supreme Being (4,437 reputation)Supreme Being (4,437 reputation)Supreme Being (4,437 reputation)Supreme Being (4,437 reputation)Supreme Being (4,437 reputation)Supreme Being (4,437 reputation)Supreme Being (4,437 reputation)

Group: Forum Members
Last Active: Last Month
Posts: 3,055, Visits: 4,055

Hi Lance,

We could not replicate the problem using the provided code below - please send an app replicating the problem to support@nevron.com. Also we were unable to replicate this problem using the standard examples shipped with the control.



Best Regards,
Nevron Support Team



Lance Levendowski
Posted 9 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)

Group: Forum Members
Last Active: Last Year
Posts: 60, Visits: 157
Please try my example using a DPI setting of 125% and let me know if that allows you to reproduce the issue.  The resolution of my screen is 1920 x 1080.


Nevron Support
Posted 9 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,437 reputation)Supreme Being (4,437 reputation)Supreme Being (4,437 reputation)Supreme Being (4,437 reputation)Supreme Being (4,437 reputation)Supreme Being (4,437 reputation)Supreme Being (4,437 reputation)Supreme Being (4,437 reputation)Supreme Being (4,437 reputation)

Group: Forum Members
Last Active: Last Month
Posts: 3,055, Visits: 4,055
Hi Lance,

In order to be printable most chart properties related to line width are specified in points (instead of pixels). Depending on the resolution this width may not be a number which is an exact round to pixel. To workaround this you can specify pixel width to legend grid lines - for example:

           legend.HorizontalBorderStyle.Width = new NLength(1, NGraphicsUnit.Pixel);
            legend.VerticalBorderStyle.Width = new NLength(1, NGraphicsUnit.Pixel);
            legend.OuterLeftBorderStyle.Width = new NLength(1, NGraphicsUnit.Pixel);
            legend.OuterRightBorderStyle.Width = new NLength(1, NGraphicsUnit.Pixel);
            legend.OuterTopBorderStyle.Width = new NLength(1, NGraphicsUnit.Pixel);
            legend.OuterBottomBorderStyle.Width = new NLength(1, NGraphicsUnit.Pixel);

Hope this helps - let us know if you meet any problems or have any questions.


Best Regards,
Nevron Support Team



Lance Levendowski
Posted 9 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)

Group: Forum Members
Last Active: Last Year
Posts: 60, Visits: 157
Thank you for the feedback.  I tried setting the BorderStyle.Width properties that you listed to "new NLength(1, NGraphicsUnit.Pixel)", but that did not prevent text in the legend from being clipped.

Were you able to reproduce the issue using my example code with a DPI setting of 125%?

I've also noticed that the size of the NChartControl affects the issue.  For example, if I run my example code then the top of text in the legend is clipped.  If I increase the size of the form then text in the legend is no longer clipped.  But, if I keep increasing the size of the form then text in the legend becomes clipped again.

The same is true if I run "All Examples - Panels - Legend - Position" and set the chart's Render Surface to Window (see screen shot).

72% of original size (was 697x19) - Click to enlarge
https://www.nevron.com/forum/uploads/images/d2e31309-6393-43d5-9713-4cae.png




Nevron Support
Posted 9 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,437 reputation)Supreme Being (4,437 reputation)Supreme Being (4,437 reputation)Supreme Being (4,437 reputation)Supreme Being (4,437 reputation)Supreme Being (4,437 reputation)Supreme Being (4,437 reputation)Supreme Being (4,437 reputation)Supreme Being (4,437 reputation)

Group: Forum Members
Last Active: Last Month
Posts: 3,055, Visits: 4,055
Hi Lance,

We still cannot reproduce this problem - we tested with 125% dpi on a Win7 machine using the latest version and there was no text clipping - what is the version you're currently testing with? Also what is the version of Windows?


Best Regards,
Nevron Support Team



Lance Levendowski
Posted 9 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)

Group: Forum Members
Last Active: Last Year
Posts: 60, Visits: 157
The issue exists in builds 16.4.15.12 and 16.5.9.12.

System Specs:
Windows 10 Pro x64
Intel Core i7-4790K
Geforce GTX 980M (Driver 365.10-notebook-win10-64bit)
32 GB RAM
1920 x 1080
125% DPI


Nevron Support
Posted 9 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,437 reputation)Supreme Being (4,437 reputation)Supreme Being (4,437 reputation)Supreme Being (4,437 reputation)Supreme Being (4,437 reputation)Supreme Being (4,437 reputation)Supreme Being (4,437 reputation)Supreme Being (4,437 reputation)Supreme Being (4,437 reputation)

Group: Forum Members
Last Active: Last Month
Posts: 3,055, Visits: 4,055

Hi Lance,

This issue is most likely related to the video board as we were unable to reproduce it on Win7/Win10 machines. Do you experience this behavior on other machines as well?



Best Regards,
Nevron Support Team



Lance Levendowski
Posted 9 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)

Group: Forum Members
Last Active: Last Year
Posts: 60, Visits: 157
You are correct that this issue seems to be dependent on the video card.

I tested my sample code on several computers and here are the results:

1. GeForce GTX 760, Windows 10 x64 - Legend text is clipped at various chart sizes as it is on the GeForce GTX 980M
2. Old Notebook with Radeon Video Card, Windows 10 x64 - No issues with the Legend.
3. Desktop using Intel HD Graphics 4000, Windows 7 x64 - Several characters in the Legend are displaced to the top-left corner, most other characters appear washed out (see image).

72% of original size (was 697x19) - Click to enlarge
https://www.nevron.com/forum/uploads/images/9d6cea2a-410b-4ca0-97a3-9957.png


Hope this helps.  Please let me know if you need any more information.


Lance Levendowski
Posted 9 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)

Group: Forum Members
Last Active: Last Year
Posts: 60, Visits: 157
Can you please give me an update on this issue?
Thank you.




Similar Topics


Reading This Topic

1 active, 1 guest, 0 members, 0 anonymous.
No members currently viewing this topic!