Reksio

position of Text in a stackedbar2d

Recommended Posts

Hello,

I have several stackedbar2d with very different values. In the bars have to be a text with also the value of the bar.

For the position of the text I have this line:

"x": "$dataset.1.set.0.X - 90",

in the script for the stackedbar2d.
The number of the x-position I have to change by every value of the bar length, otherwise the text is not on the same position in display.

Is there any solution for this problem? Maybe by an calculation with the whole length of both bars in pixel and a constant?

Here is an fiddle example for that.

first chart:
 

 "groups": [
              {
                "id": "Callout", "items": [
                  {
                    "id": "CalloutLabel0",
                    "type": "Text",
                    "fontSize": "12",
                    "bold": "0",
                    "fillcolor": "#333",
                    "text": "N=164 MW=5.8",
                    "align":"left",
                    "x": "$dataset.1.set.0.X - 200",
                    "y": "$dataset.0.set.0.starty + 10"
                  },

$dataset.1.set.0.X - 200

in the chart below:

$dataset.1.set.0.X - 320

if both has $dataset.1.set.0.X - 320 then you have this result here. (please use chrome browser for fiddle maybe)

 

Edited by Reksio

Share this post


Link to post
Share on other sites

Maybe there is no developer who wants or can or both to reply to this question or is it not comprehensible?

Actually I only need the name of the property for the whole length of both horizontal bars.

Edited by Reksio

Share this post


Link to post
Share on other sites

Hi Reksio,

 

In your implementation of annotations in StackedBar chart is not utilizing the macros optimally, because you are placing the annotation texts on the first dataset(Grey - #D9D9D9), but you are setting the macro in "x" attribute with respect to the second dataset(Green or Red) as below :

"x": "$dataset.1.set.0.X - 320",

which is not a proper implementation.

You need to set the macros in the "x" attribute with respect to the dataset and set(plots) on which you are displaying the annotations. This will help you to align them all using the same padding with the macros for the respective annotations. Refer to the code below :

Plot 1 - "x": "$dataset.0.set.0.STARTX+30",

Plot 2 - "x": "$dataset.0.set.1.STARTX+30",

Plot 3 - "x": "$dataset.0.set.2.STARTX+30",

Plot 4 - "x": "$dataset.0.set.3.STARTX+30",

Plot 5 - "x": "$dataset.0.set.4.STARTX+30",

 

Also find a Sample fiddle for reference : http://jsfiddle.net/1t8bv9cb/

 

Thanks,

Akash.

Share this post


Link to post
Share on other sites
On 6.3.2018 at 8:59 AM, Akash Biswas said:

Hi Reksio,

 

In your implementation of annotations in StackedBar chart is not utilizing the macros optimally, because you are placing the annotation texts on the first dataset(Grey - #D9D9D9), but you are setting the macro in "x" attribute with respect to the second dataset(Green or Red) as below :

"x": "$dataset.1.set.0.X - 320",

which is not a proper implementation.

You need to set the macros in the "x" attribute with respect to the dataset and set(plots) on which you are displaying the annotations. This will help you to align them all using the same padding with the macros for the respective annotations. Refer to the code below :

Plot 1 - "x": "$dataset.0.set.0.STARTX+30",

Plot 2 - "x": "$dataset.0.set.1.STARTX+30",

Plot 3 - "x": "$dataset.0.set.2.STARTX+30",

Plot 4 - "x": "$dataset.0.set.3.STARTX+30",

Plot 5 - "x": "$dataset.0.set.4.STARTX+30",

 

Also find a Sample fiddle for reference : http://jsfiddle.net/1t8bv9cb/

 

Thanks,

Akash.

THANK YOU very much, Akash.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now