Skip to Content
0

Getting duplicate legend values in Line Chart with 2 Y-Axes

Dec 11, 2017 at 01:55 PM

54

avatar image
Former Member

Hi Pros,

I am getting duplicate legend values for every value i select in Listbox.

I have created two measures and based on a condition the values are getting stored in both measures. These values are generated against a dimension field and as per the condition if a value is generated in one measure then for other measure the value will be null. Now when i select a particular value from listbox i get a single axis against that but two legends. Please find attached the screenshot legend-issue.pngt for the same. I need to have single legend for the axis for which i am getting value. Thanks in advance.

Arpit

legend-issue.png (34.6 kB)
10 |10000 characters needed characters left characters exceeded

What is the data source? Is it a BEx Query? Which version/SP of Design Studio are you using?

0
Former Member

Hi Tammy,

I am using universe as data source, i am on DS 1.6 SP3.

Thanks & Regards

Arpit Arora

0
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Arijit Das Dec 12, 2017 at 08:51 AM
0

This is how I tried to replicate a similar scenario:

I have created 2 css classes as below:

.hideLegend1 .viz-legend-valueLabel g:nth-child(1){
   visibility:hidden;
}

.hideLegend2 .viz-legend-valueLabel g:nth-child(2){
   visibility:hidden;
}

Now, the on startup event of application, I used the script below. You have to use same script in the on selection event of the listbox as well.

if(DS_1.getData("_GIiL54mPEee2VZjheZxFZQ", {}).formattedValue == ''){ // If the first measure is null
       INFOCHART_1.setCSSClass('hideLegend1');
}else{ // If the second measure is null
       INFOCHART_1.setCSSClass('hideLegend2');
}

In initial view of the data source, I used Sum to calculate total of the measures so that the total is blank in case all values are null.

Thus, if one measure provides all null values, the legend for the same is hidden in the infochart.

Show 7 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hi Arijit,

This solution is working for a single value but when i select multiple values then again i am getting duplicate legends.

Thanks & Regards

Arpit Arora

0

Probably you are using Taglist and Measures both in columns (or both in rows) of the initial view of data source.

0
Former Member

Nope, I am using Taglist in Rows and Measures in column.

Thanks & Regards

Arpit Arora

0

Can you please post a screenshot of the initial view ?

0
Former Member
Arijit Das

legend-issue-ds.pngPlease find attached the screenshot of initial view.

Thanks.

legend-issue-ds.png

0

In this case the number of legend items will be dynamic and it will not be possible to hide the correct items from css. Only solution I can think of is to modify the back end to have a single measure and a dimension to toggle between high and low (not sure if it is possible for you to make such a big change in the data model).

0
Former Member
Arijit Das

I have tried with single measure but as per the requirement the values for some tags are very low and for some are very high so to make all the tag values visible and at some level we need dual axis, but i think due to legend getting duplicate we won't be able to achieve that. I think this is a limitation or some kind of bug in SAP Design Studio 1.6 SP3 base pack.

Thanks

Arpit

0