I am investigating the possible use of xamWebChart in a new Silverlight app I am writing. I need to be able to render the visible portion of this chart as a jpg or png file to the local isolated file storage area. Is there any way to do this? I see no obvious method on the xamWebChart to do this.
The chart does not have a native way to perform this action. You can use WriteableBitmap to capture the current view of the chart, but I don't believe Silverlight has built in methods for converting that to a JPG, but see here: http://www.silverlightshow.net/items/Capturing-a-Silverlight-Screen.aspx
for more info as to how to proceed.
And see this thread: http://community.infragistics.com/forums/p/37554/217880.aspx#217880
for more info on using WriteableBitmap with xamWebChart.
Hope this helps!
-Graham
I have succeeded in rendering my xamWebChart, converting it to a WriteableBitmap and then converting it to a jpg using fjcore.
All is great except that the background is showing up in the jpg as black since jpgs cannot have transparency. I tried setting the chart background to white (that is acceptable) but I then get a 10 pixel black border around an otherwise perfect chart.
The border is showing up as black because of the padding associated with the xamWebChart. If I set the padding to 0 everything is great but the WriteableBitmap does not include all of the image because the xamWebChart writes into the padding area (that seems wrong) and therefore some of the axis indicators are chopped off.
My initial thought is to set the padding background to white but I see no way of doing that.Do you havea any other suggestions on how to do what I need?
Thanks
Try putting the chart in a Grid, and setting the grid's background to white, then capture the image of the grid containing the chart, rather than the chart itself. See if that helps.
Words cannot express my gratitude. That works great. I was looking forward to a very busy weekend finding a way around this problem and you solved it in 10 minutes. Thanks