[CLOSED] export chart to SVG

Page 2 of 4 FirstFirst 1234 LastLast
  1. #11
    Quote Originally Posted by feanor91 View Post
    Many many thanks, you extract a thorn from my foot with that code.

    One of the main function of my next application version.

    I will adapt it to my need when my dynamic charts will be functionning.
    I've got a problem which I can't really resolved. Its in my previous posts, it is that somehow IE render the animation a bit slowly that is why I put 2.5 seconds. I wanted to trigger an upload to the server as soon as the animation has finished, however the afterAnimate event fired many many times as the chart is composed of many sub-animation and each of that will fire an event. I hope ExtJS would fix the API and only have one container parent animation so that I can just register the event with the parent animation.... may be you have a better idea on which the SVG should be generated and uploaded to the server?
  2. #12
    I've got a problem which I can't really resolved. Its in my previous posts, it is that somehow IE render the animation a bit slowly that is why I put 2.5 seconds. I wanted to trigger an upload to the server as soon as the animation has finished, however the afterAnimate event fired many many times as the chart is composed of many sub-animation and each of that will fire an event. I hope ExtJS would fix the API and only have one container parent animation so that I can just register the event with the parent animation.... may be you have a better idea on which the SVG should be generated and uploaded to the server?
    You can try to set Buffer="5000" for AfterAnimate listener. In this case, listener will wait 5 sec before handler is executed, if another AfterAnimate will be fired then previous handler will not be executed and new event will wait 5 sec
  3. #13
    Ok, as I previously said, I will dig in that in a few weeks, I think, meanwhile, the charts is very slowly dranw into IE, apprently, it is because of the javascript engine of Ie (to be confirm). if it is true, there is no solution other than using another browser (but in enterprise world...), so we have to deal with that proble (and IE9 is not faster than 8 or 7).

    but, for my need, it is not very bad, because people will wait chart is fully drawn to make what they want.

    Besides that, I'll keep you in touch with my own works, if I found something.
  4. #14
    the charts is very slowly dranw into IE,
    Did you try to disable animation? How much points you render in the chart?
    If you render a large amount of points then you can consider to reduce amount of points with shape saving (approximate your chart). Please review
    http://en.wikipedia.org/wiki/Ramer-D...cker_algorithm
    http://mourner.github.com/simplify-js/
  5. #15
    I don't now, about 100 points in 8 curves. It is true, I have not play with tha naimation part and such a thing. Thanks for giving track, I will di into...too. Meanwhil if you look at Ext.NET examples inot IE and Chrome, for example, you will see a big differnece.
  6. #16
    Chrome is far much more smooth when animation is involved in the charts.

    I've got a pie, radar, column they rendered in IE without problem, although animation is not smooth at all but at least displayed.

    However I have a line graph with 3 lines, about 10 data point each. In IE with the default animation is painfully slow that it can't even display and IE generated warning saying the javascript is not responding in time. I have to disable the animation. I think the problem is IE doesn't natively support SVG and they are using a conversion from SVG to the canvas function that IE understand to do animation, that probably slows down the whole thing. But it is really much more impression if the charts have animations, you know the end users like this kind of useless stuff.....
  7. #17
    Chart doesn't use a canvas, if SVG is not supported by a browser then VML will be used (VML is used in old IE versions)
    IE9 supports SVG but as always IE engines are very slow in comparte with other browsers
  8. #18
    Quote Originally Posted by Vladimir View Post
    You can try to set Buffer="5000" for AfterAnimate listener. In this case, listener will wait 5 sec before handler is executed, if another AfterAnimate will be fired then previous handler will not be executed and new event will wait 5 sec
    Hi Vladimir

    I've tried to put Buffer="5000" if you specified but I still got a lot of events.... Do you know why? I am using the source code from SVN a few days ago. It would be lovely if I could get this buffer working. Thank you so much

    Chris
  9. #19
    Hello

    At least, I am at the point where I want to use the save graph system.

    I have downloaded svg.dll, some example, and write the code but it did not work.

    When I arrive on that line :

    svgGraph.Draw.Save("c:\test.png")
    Witch is roughly simple, I get an error because that line :

    svgGraph = Svg.SvgDocument.Open(xd)
    return a nul object.

    Here the full code behind I called :

    Private Sub SavePNG(ByRef SaveStream As Stream, ByVal SVGDoc As String)
    
            Dim xd As New XmlDocument()
            xd.XmlResolver = Nothing
            xd.LoadXml(SVGDoc)
            Dim svgGraph As SvgDocument = New SvgDocument
    
            svgGraph = Svg.SvgDocument.Open(xd)
    
            svgGraph.Draw.Save("c:\test.png")
            'svgGraph.Draw().Save(SaveStream, System.Drawing.Imaging.ImageFormat.Png)
    
        End Sub
    
        <DirectMethod()> Public Sub SaveCharts(ByVal chartName As String, ByVal chartSVG As String)
    
            Dim ms As New MemoryStream()
            SavePNG(ms, chartSVG)
    
            'ms now contains the bitmap in PNG form of the chartSVG.... do whatever you need to do there, either save it to file or store in database etc
        End Sub
    If I look into xd data, I have something, but is it the right thing?

    Here the call to the directmethod from javascript :

    var SaveChartClick = function (chart)
    {
        App.direct.SaveCharts( chart ,Ext.draw.engine.SvgExporter.self.generate(null, Ext.getCmp(chart).surface));
    };
  10. #20
    Quote Originally Posted by Vladimir View Post
    Also, you can export a chart to image (please note that Sencha.IO is used for that)
    See
    https://examples2.ext.net/#/Chart/Area/Basic/
    Please, could you be more clear about that solution, I found nothing relievant in the example code, and I try to use it as if, and of course, it did not work.
Page 2 of 4 FirstFirst 1234 LastLast

Similar Threads

  1. [CLOSED] Export Chart as Image
    By jchau in forum 2.x Legacy Premium Help
    Replies: 7
    Last Post: Feb 28, 2014, 5:14 AM
  2. [CLOSED] How to Export SVG chart from code behind
    By feanor91 in forum 2.x Legacy Premium Help
    Replies: 4
    Last Post: Jun 27, 2013, 6:20 AM
  3. Replies: 2
    Last Post: Aug 13, 2012, 2:12 PM
  4. Replies: 1
    Last Post: Jun 02, 2012, 7:12 AM
  5. Replies: 1
    Last Post: Apr 19, 2010, 2:44 PM

Tags for this Thread

Posting Permissions