174
Views
15
Comments
Solved
Legend alignment for donut chart

Can I make the legends to be displayed horizontally instead of vertical and also how can I reduce the thickness of the circle?

I want to display like below

Regards,

Shree

2023-04-16 15-25-31
Krishnanand Pathak
Solution

Hi @Shreelakshmi Shivaramu
If you want customize to the legends style(like font size of label) then use the below
JSON snippet :


"plotOptions: {
      pie: {
          innerSize: '80%'
      }
  },
  legend: {
        itemDistance: 2,
        symbolPadding:1,
        itemStyle: {
                 fontSize:'10px'
              },
    },
  "


itemDistance is the distance between legends.

symbolPadding is the distance between legend symbol and label.
Adjust the fontSize as per your requirement.

Regards
Krishnanand Pathak




 

2025-09-04 06-33-37
Nikhil___Vijay

Hello @Shreelakshmi Shivaramu 

You can gothrough this link hope it will solve your issue

https://www.outsystems.com/forums/discussion/66794/outsystems-charts-donut-chart-display-full-legend/

Regards 

Nikhil kumar vijay

2025-02-04 10-17-42
Shreelakshmi N S
Champion

Hi Nikhil,

I tried that too but didn't help, After doing that it would appear like this

Rather I want the legends to display horizontally

2023-04-16 15-25-31
Krishnanand Pathak

Hi @Shreelakshmi Shivaramu 

  1. To Increase the width of chart to display legends horizontally.
  2. To reduce thickness add the below JSON snippet to chart -> AdvanceFormat->HighChartsJSON property

    "plotOptions: {
          pie: {
              innerSize: '80%'
          }
      }"



OML is also attached to reference.


Regards
Krishnanand Pathak

Donut Chart.oml
2025-02-04 10-17-42
Shreelakshmi N S
Champion

Thank you for the response,

The JSON is working to reduce the thickness but not for the legend position, Its still aligning vertically.

2023-04-16 15-25-31
Krishnanand Pathak

Increase the width of parent container or wrapper(So that lengends get the required space to align horizontally) of the chart. As I did in the shared oml.
Also check the Demo here.

2023-04-16 15-25-31
Krishnanand Pathak
2025-02-04 10-17-42
Shreelakshmi N S
Champion

Hi Krishna,

I understand that it would work when I increase the width but my requirement is to display the chart within 2 col width and need to show 6 charts in a single horizontal line. In that case is there any way I could reduce the font-size of the legend labels and make the legends alignment to be horizontal?

Regards,

Shree

2023-04-16 15-25-31
Krishnanand Pathak
Solution

Hi @Shreelakshmi Shivaramu
If you want customize to the legends style(like font size of label) then use the below
JSON snippet :


"plotOptions: {
      pie: {
          innerSize: '80%'
      }
  },
  legend: {
        itemDistance: 2,
        symbolPadding:1,
        itemStyle: {
                 fontSize:'10px'
              },
    },
  "


itemDistance is the distance between legends.

symbolPadding is the distance between legend symbol and label.
Adjust the fontSize as per your requirement.

Regards
Krishnanand Pathak




 

UserImage.jpg
Rakshith Bhairanatti

This is not working for me


2023-04-16 15-25-31
Krishnanand Pathak

It is working, You can check the Demo.
Sharing the oml for better understanding.

TestCom.oml
UserImage.jpg
Rakshith Bhairanatti

I want to reduce thickness of this donut, the circle thickness, 

"{    title: {        text:' Total User "+ CardTotalUsers.Current.Value+"',        align: 'center',         verticalAlign: 'top',        style: {            fontWeight: 'bold',            fontSize: 15        }    }    plotOptions: {      pie: {          innerSize: '80%'      }  }}", 

donut.png
2023-04-16 15-25-31
Krishnanand Pathak

Have you check the oml and demo shared above. I have reduced the circle thickness as you can see in demo.
Or you can share the oml if possible.

2023-04-16 15-25-31
Krishnanand Pathak

Hi @Shreelakshmi Shivaramu,


Is the above solution worked for you?


Regards
Krishnanand Pathak

2025-02-04 10-17-42
Shreelakshmi N S
Champion
2024-11-25 22-05-29
Sergio Aznar Guallar

Hi @Shreelakshmi Shivaramu,

try this code in HighchartsJSON:

"legend: {

                align: 'center',               

                verticalAlign: 'bottom',

                layout: 'horizontal'

}"

hope it helps you,  let me know if it works in your case


Kind regards,

Sergio

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.