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
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,
Hi Mike,
That's excellent stuff. Thanks for the advice.
Hi Nathan,
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.
Hi Nick,
I have tried this, however I could only get the ultrachart to save an image to file and then to convert that image into an image object in my class that gets bound to the grid. I couldn't get the chart to save a memorystream or get the image property of the chart to pass back an image. I then had the problem of trying to get the row to size accordingly, but I'm confident I could get around that. If the memorystream bit worked then I could probably get away with using an image. Having the system create potentially thousands of images on the disk in order to display in the grid isn't a very attractive option.
Must admit I'm not to familiar with Ultrachart but I have seen this method recommended with other reporting type products. If Ultrachart can be rendered to a picture how about just showing that in the grid?
Nick