Chartdirector Question

(2 posts) (2 voices)
  1. ajdjackson, Member

    Afternoon all,

    I've been trying to create a visual that would display a period value, say weekly sales, with the last 12 weeks sales as the background.

    So I've tried using addText to an area chart. This is where I've got to:

    The code I've used to produce the above:

    declare @wsaless varchar(10); declare @wsales int=10;

    set @wsaless=format(@wsales,'N0');

    select 'dbr.chart','Area', '',300,150; select 'dbr.chart.options','chartdirector',concat('$c->addText(100,50,"£',@wsaless,'","",30);'); select 'dbr.chart.options', 'hide', 'bg,xaxis,yaxis,grid'; select 'dbr.chart.color', '#ccffcc';

    select a.weeknum,sum(a.val) from #weeksales a group by a.weeknum order by a.weeknum;

    First issue I have is that the 'hide' isn't hiding the x-axis labels - not sure why.

    My main issue is how can I horizontally align the text box created by the addText? My understanding is that the x,y in the addText refers to left-top corner of a text box created by the addText command. This text box will expand/shrink depending on the value of @wsaless. I couldn't find a way to use some form of relative positioning.

    Is there a better way to create the visual. If not do you know how I can better centre the text?

    Thanks

    Jake

  2. myDBR Team, Key Master

    You can use:

    select 'dbr.chart.options', 'hide', 'all';

    , or run the automatic updater.

    To horizontally align the text use the CharttDirector alignment specification:

    select 'dbr.chart.options','chartdirector',concat('$c->addText(150,75,"£',wsaless,'","",30, TextColor, Center);');

    --
    myDBR Team


Reply

You must log in to post.