When a chart is created, it is (normaly) saved with a sequence number embedded in the file name, and the control takes care of reusing the files etc... How can I get the actual name (including sequence number) of a chart? I have a situation where a chart is generated on one page and actually displayed on another. The traffic on the site is such that I do not need to worry about the chart being overwritten to soon, I just need to know where exactly where infragistics put it. I know I can specify a filename, but then I have to do the cleanup etc...
How do I get the full file name of a chart created by IG?
You should be able to get the image with chart.DeploymentScenario.ImageURLResolved1 for the chart image and ImageURLResolved2 for the base image (you will have 2 images if you use a scrollbar). You can use FillSceneGraph event or ChartDrawItem event to get these property values.
I'm sorry to respond to an old post but I'm having the same problem and am at a loss as to how to get at these properties. I've tried linking into the ChartDrawItem method but that's called multiple times per chart and there's no access to the actual chart object being rendered. I need the final image generated by the chart. When is the chart.DeploymentScenario.ImageURLResolved1 property actually set and how can I get to it?
Matt
The ImageUrlResolved properties are set whenever the chart is re-painted and before it's rendered on the screen. You should have no problems accessing the chart through any of the events, since you don't need to access the chart through the event args. For example, somewhere on the page you have your ultraChart1 that is accessible everywhere on that page. So inside ChartDrawItem or FillSceneGraph you can just use ultraChart1.DeploymentScenario..... If for some reason you can't do that, use the sender parameter and cast it to UltraChart. FillSceneGraph will fire once every time the chart is refreshed, ChartDrawItem will fire once for every primitive in the chart.
Thanks for your feedback. I was able to get the file names on UltraChart1_FillSceneGraph event.
Private _chartimagePath As String Public Property ChartImagePath() As String Get Return _chartimagePath End Get Set(ByVal value As String) _chartimagePath = value End Set End Property Private Sub UltraChart1_FillSceneGraph(ByVal sender As Object, ByVal e As Infragistics.UltraChart.Shared.Events.FillSceneGraphEventArgs) Handles UltraChart1.FillSceneGraph Me.ChartImagePath = UltraChart1.DeploymentScenario.ImageURLResolved1 ''Dim y As String = UltraChart1.DeploymentScenario.ImageURLResolved2 End Sub
Here is the solution I came up with. I think there's an easier way to get at this property with the newer versions, but it didn't much help us with our version. We all know that while these libraries are functionally sound, the Infragistics documentation leaves much to be desired.
The UltraChart.DeploymentScenario.ImageURLResolved1 property gets populated while the chart object is being drawn. I found that if I added an Event Handler to the ChartDrawItem Event that this property would eventually get populated, allowing you to read it and store it to a member variable. If I remember correctly, it wasn't there until this was called several times. This event is called when each little piece of the chart is drawn so you may have to step through it a few times before you see it.
AddHandler myChart.ChartDrawItem, AddressOf ReadGraphUrl
Private Sub ReadGraphUrl(ByVal sender As Object, ByVal e As ChartDrawItemEventArgs) m_chartURL = myChart.DeploymentScenario.ImageURLResolved1 m_localPath = Server.MapPath(myChart.DeploymentScenario.ImageURLResolved1)End Sub
The m_chartURL variable will give you the path to the file relative to the web root (I believe), and m_localPath will give you a full Path, drive letter and all. I implemented this a few months ago and haven't looked at it since, so you'll have to bear with me. Let me know if you have any questions and I hope this helps.
p.s. sorry for all the edits, this stupid control keeps removing my line breaks.
How did you get the image file name ? I am fiddling with it from last two days. and no success
Hi,
Thanks for your help. I managed to get directly at the chart object but it wasn't easy because of the way our controls are implemented.
Thanks,Matt
Yeah, FillSceneGraph event was added in 7.3. Good call on the sender type in ChartDrawItem event, that won't give you the chart reference. Is there a reason why you can't just refer to the chart by its instance name? Maybe you can describe your scenario a bit more.