on 06-25-2015 1:10 PM
Hello Everyone,
Current Situation:
The default legend in I5 chart is placed on right hand side of chart area.
It will automatically re-size the chart area and legend area.
Now when legend names gets too long, it will reduce chart area largely. Resulting in smaller chart view.
Preventive Thought:
To avoid above situation, I had an idea to put legend area horizontally(may be divided in 2/3 rows) below chart area.
This will prevent chart area re-sizing largely.
But I couldn't find this customization in MII. Please suggest some solution to this problem statement?
Please suggest your Ideas.
Regards,
Minakshi
Hi Minakshi,
If you're using sapui5 viz charts, you can use legendGroup property to set the legend at bottom. If legend value is too big, you can use the scrollable property.
var oDualChart = new sap.viz.ui5.DualLine(
{
id: "dualline",
width : "50%",
height : "300px",
legendGroup :new sap.viz.ui5.types.Legend({layout:new sap.viz.ui5.types.Legend_layout({position :sap.viz.ui5.types.legend.Common_position.bottom}) }),
legend : new sap.viz.ui5.types.legend.Common({isScrollable:true}),
title: {
visible : true,
text : 'Profit & Measure By Region & Company'
},
dataset: oDataset
}
);
Final Output will have horizontal scroll bar, showing all legends.
JS Bin - Collaborative JavaScript Debugging
If it is i5 Chart, I need to check on it.
Regards,
Sai Vellanki
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Bharath,
You want to place legend inside the chart - center position / top of chart - center position / bottom of chart - center position?
Yes as per UI5 API, we have only top, bottom, right and left positioning.
Regards,
Sai Vellanki.
Hi Paulo,
You might need to hack it using DOM manipulation.
A rough code: Plunker
If you spend some time, we can make the code more generic though!
Regards,
Sai Vellanki.
Thanks for sharing the code, is really what I wanted.
In the meantime I found an workaround for my particular case. Since the width of my chart is small, the legend items are wrapped to multiple lines, ending with a similar effect. I used the following properties
legendGroup : { |
layout : {
position : 'bottom',
maxWidth : 100,
alignment : 'center'
}
} |
User | Count |
---|---|
11 | |
6 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.