WebGrid & Charts Examples?

I have two worksheets (Data and Chart). Data as the values 10, 20, 30, 40, 50, 60, 70, 80, and 90 listed in column A. Chart has a very simple Bar Graph on it, which gets it’s data from the Data worksheet I just specified. However if I change a value on the Data sheet and submit, the charts do not update.

I would like to know how to programmatically OnSubmitCommand, refresh the Bar Graph as part of the WebGrid WorkSheet.

P.S. The Initial WebGrid is loaded from a Workbook object, which is loaded from an Excel Template (I’m not sure if that matters at all).

Hi,


Do you create the chart by Aspose.Cells library and show it in Aspose.Cells.GridWeb control?

Could you create a sample project, zip it and attach it here to show the issue, we will check it soon.

Also, we recommend you kindly try our latest version of the Aspose.Cells (v7.2.0) and/or Aspose.Cells.GridWeb (v2.7.5.xxxx). You may download and install the MSI installer of the Aspose.Cells for .NET package @:
http://www.aspose.com/community/files/51/.net-components/aspose.cells-for-.net/entry375305.aspx


Thank you.

Currently I have not created the chart with ASPOSE Cells, the charts are part of an excel template that I load. However I could not find an object reference to the charts within the GridWeb object (though I did see some in the WorkBook object). All I really want to know is how to refresh the charts so they pickup on any data changes being made. I have attached a sample, but it’s so bare basic it really isn’t even worth the 5MB.



P.S. GridWeb.SaveToStream fails when chart images are present:

Type ‘System.Drawing.Imaging.ImageFormat’ in Assembly ‘System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ is not marked as serializable

I was trying to save the GridWeb as a MemoryStream and load that MemoryStream into a WorkBook so I could get access to the charts. I guess the charts aren’t stored as charts then, but rather images? How are we supposed to “edit/update” charts with ASPOSE Cells if the chart data isn’t persisted… are we expected to recreate the charts each and every time? and if so, I still have no clue how to do that with a GridWeb.

Is there an easy way to get interchange GridWeb and WorkBook data?

Hi,


Well, I am afraid, yes, you cannot access or control the charts or the related objects in GridWeb control, the reason is the charts (in the template Excel file) are rendered as images only in the GridWeb.

For manipulating charts or other objects, you have to use Aspose.Cells library that can manipulate charts at every level on the back end or in the background, this might involve certain repetition of code segments etc. if you want to dynamically change the charts or its data. In short, we do not recommend Aspose.Cells.GridWeb control to do the manipulation of charts. We only recommend you use the control as the final and passive display of the charts in it it.
Just for reference or hints, a similar topic is given here, but this article is using three components (Aspose.Cells.GridWeb, Aspose.Cells and Aspose.Chart (which is obsoleted now).
http://www.aspose.com/docs/display/cellsnet/Dynamically+Generate+Formatted+Excel+Reports+with+an+Elegant+Graph
(You may exclude the Aspose.Chart product which is not with Aspose any more now and use only Aspose.Cells and Aspose.Cells.GridWeb components for the task. Not sure if this is worthwhile for your needs. Aspose.Cells does support to convert the chart to image now, see the document here: Chart to Image|Documentation)

Also, see the topics on how to create and manipulate charts using Aspose.Cells library: