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?
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.
Matt
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.