Cannot Rotate coordinates on a clipped Graphics from Graphics.Clip

I’m seeing an UnsupportedOperationException (Cannot Rotate coordinates on a clipped Graphics from Graphics.Clip) while trying to save an Image of a DesktopChart Control to Disk using DrawInto.

Xojo 2023r4 on Windows 10.

Function ContextualMenuItemSelected(selectedItem As DesktopMenuItem) As Boolean
  Select Case selectedItem.Text
    
  Case "Als Bild speichern..."
    
    Var pngType As New FileType
    pngType.Name = "image/png"
    pngType.Extensions = ".png"
    
    Var f As FolderItem = Folderitem.ShowSaveFileDialog(pngType, Me.Title + ".png")
    
    If f <> Nil Then
      
      If f.Exists Then f.Remove
      
      Var p As New Picture(Me.Width, Me.Height)
      
      Try
        
        Me.DrawInto(p.Graphics, 0, 0)
        p.Save(f, Picture.Formats.PNG)
        
      Catch err As UnsupportedOperationException
        
        MessageDialogSimple(MessageDialog.IconTypes.Stop, "Ok", "Das Speichern dieser Grafik ist mit dieser Version des WAG5 leider noch nicht möglich.")
        
      End Try
      
    End If
    
  End Select
End Function

In other locations, this Method works just fine. In the LR is written “DrawInto will only work if the control is on a window or container.” and this Chart is on a TabPanel within a Container, within a PagePanel, within the Main Window.

And it all looks like this:

I guess xojo could add a picture getter property to get the full size graphics as picture ?
Not sure why this would not work with DrawInto…

I can replicate the issue in a very simple example project.
As soon as the Chart contains any Data, it raises the exception.

Please add a ThumbUp Vote to https://tracker.xojo.com/xojoinc/xojo/-/issues/75382 if you also use DesktopChart Controls in your projects.

Thank you. :slight_smile:

My issue may be related to https://tracker.xojo.com/xojoinc/xojo/-/issues/73774 from this Thread, because it does not raise the Exception with every kind of Chart. F.e. it does not happen with my Doughnot Charts.

According to the report, the error is reproducible.
I would be very happy if someone who also works with charts could give this report a thumbs up. :blush:

1 Like

Thumbs up from me.

It does work with my Pie charts, but not Bar charts.
So is it just Linear charts? Are then any settings for Linear charts that can drawInto on Windows?

My charts are each in a Container on a TabPanel on a Window - and works fine on Mac OS

1 Like