Hi,
Is there any way to put an ultrachart in an ultrawingrid?
Ideally I'd like to show the chart in a child row, and therefore only needs to be populated when the users drills down into the data. The data in this grid isn't consistent. The grid sits in a form that is a generic form used to display report data. Not all reports will use this feature.
If it is possible could you provide some sample code in VB.NET on what I need to do?
On a similar note, is it possible to add custom controls to work as stated above?
Many thanks,
Nathan
Hi Nathan,
No, there's no easy way to embed a chart in a grid. A grid cell can only really contain an embeddable editor control, which includes a lot of controls like UltraTextEditor, UltraMaskedEdit, UltraProgressBar, and many many others, but not WinChart.
If you want to have a dropdown with a chart on it, or any other control, then that would be very easy using the UltraTextEditor with a DropDownEditorButton in the ButtonsRight or ButtonsLeft collection.
Hi Mike,
Bit of a blow however thanks for the response.
Mike Saltzman"] A grid cell can only really contain an embeddable editor control, which includes a lot of controls like UltraTextEditor, UltraMaskedEdit, UltraProgressBar, and many many others, but not WinChart.
A grid cell can only really contain an embeddable editor control, which includes a lot of controls like UltraTextEditor, UltraMaskedEdit, UltraProgressBar, and many many others, but not WinChart.
Is there an interface that the wingrid uses to determine whether it's an embeddable editor control? I'm wondering if there is an inteface to implement in order to create a custom control for the wingrid to accept.
redox said:Is there an interface that the wingrid uses to determine whether it's an embeddable editor control? I'm wondering if there is an inteface to implement in order to create a custom control for the wingrid to accept.
Yes, the interface is IProvidesEmbeddableEditor. There's only one property on this interface: Editor. This doesn't make it easy to implement, though. The Editor property is of type EmbeddableEditorBase. So you would have to derive your own editor class that wraps the Chart. This is the hard part.
If you want to attempt this, you might want to check out the RichText Embeddable Editor sample that comes with the NetAdvantage SDK. This sample demonstrates how to create an editor that wraps the Inbox RichTextBox control. So you could probably modify the sample code to use WinChart.
Oh... I'm not all that familiar with WinChart, but I'm sure there must be a way to get it to paint into a Bitmap in memory rather than a file. Perhaps you should ask about this in the WinChart forum or Submit an incident to Infragistics Developer Support and ask if there's an easy way to do that.
That's excellent stuff. Thanks for the advice.
An update for anyone who may want to try this.
In the end I created images on the fly, mainly because I couldn't get my head around the c# example for inheriting the EmbeddableEditorBase.
I managed to create the image for the class representing the child band with the image property, by saving the chart to a memorystream and using Image.FromStream to convert for the property.
Using ms As New System.IO.MemoryStream
UltraChart1.SaveTo(ms, System.Drawing.Imaging.ImageFormat.Jpeg, _imageSize, _imageRes) Dim img As Image = Image.FromStream(ms)
UltraChart1.SaveTo(ms, System.Drawing.Imaging.ImageFormat.Jpeg, _imageSize, _imageRes)
Dim img As Image = Image.FromStream(ms)
End Using
The wingrid didn't seem to like the image that comes directly from the chart but was completely happy with the above conversion. I didn't have to change anything in the grid to show the image as it could work it out for itseIf. I did however resize the bands DefaultRowHeight and DefaultColumnWidth to the size of image and all worked a treat.
Thank you to everyone who gave their time to help and give advice.
Kind regads,