cancel
Showing results for 
Search instead for 
Did you mean: 

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

arpit_arora
Participant
0 Kudos

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

TammyPowlas
Active Contributor
0 Kudos

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

arpit_arora
Participant
0 Kudos

Hi Tammy,

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

Thanks & Regards

Arpit Arora

Accepted Solutions (0)

Answers (1)

Answers (1)

arijit_das
Active Contributor
0 Kudos

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.

arpit_arora
Participant
0 Kudos

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

arijit_das
Active Contributor
0 Kudos

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

arpit_arora
Participant
0 Kudos

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

Thanks & Regards

Arpit Arora

arijit_das
Active Contributor
0 Kudos

Can you please post a screenshot of the initial view ?

arpit_arora
Participant
0 Kudos

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

Thanks.

legend-issue-ds.png

arijit_das
Active Contributor
0 Kudos

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).

arpit_arora
Participant
0 Kudos

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