1. #1
    Sencha User
    Join Date
    Aug 2009
    Posts
    37
    Vote Rating
    1
    jsalisbury is on a distinguished road

      1  

    Default Adding a Chart title within the chart area

    Adding a Chart title within the chart area


    I'm using the SVG generated by the chart class to generate images on the server.

    var svgCode = Ext.getCmp('chart_' + win.id).getEl().dom.innerHTML;

    Ideally I'd like the chart title inside the chart so that the title appears in the SVG and therefore in the image.
    I've tried using a text sprite to place a title on the chart, but this can obscure the chart lines/bars.
    Ideally I'd like to create some dead space above the chart (but part of the chart), into which I can place the sprite, and therefore have it preserved in the SVG and the images.

    The other idea I had was to position the legend on top and try to add the title as the first item to the legend, but I cannot find a method to insert items into a legend.

    Does anyone have any suggestions ?

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,641
    Vote Rating
    898
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    You can either position your own sprite or nest the chart within a panel.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Feb 2011
    Posts
    4
    Vote Rating
    2
    invantix is on a distinguished road

      2  

    Default Looking for the best way to add a title to a chart area.

    Looking for the best way to add a title to a chart area.


    I know this is an old thread but I have some questions.

    If you use a panel with a title the title does not print of you use chart.save({type: 'image/png'}); Is there a way to print the panel to png?

    If you use the sprite method then the bars on the chart overlay your title. Is there a way to create a margin at the top so the bars do not collide with my Title?

    Thanks!

Thread Participants: 2