LINQ Reporting Engine - Show values in legends in doughnut chart

Our requirement is to show the values in legends of doughnut chart highlighted in attached image, where i am able to manage to create the chart with legend but without values.

Data i am using to generating the chart is -

"assestsBreakdown": [
  {
    "assests": "Alternatives",
    "value": 20.5
  },
  {
    "assests": "Bonds",
    "value": 26.1
  },
  {
    "assests": "Equities",
    "value": 45.3
  },
  {
    "assests": "Cash and Others",
    "value": 8
  }
]

So need your guidance to do soo…

@aspwanupsinha

This can be achieved by concatenating category names with numeric values for an x tag as shown at Template.docx (25.3 KB).

Thanks for your quick response and guidance, but i need the maintain the alignment as well in between asset and value fields the way i highlighted in above attached image.
anything we can do on alignment as well in legends.

@aspwanupsinha

Such layout is not supported by MS Word. Every time something unsupported is required, it becomes quite tricky if ever possible to implement. In this case, it is possible, but becomes very complex. Please check Template2.docx (28.9 KB).

The template applies the following tricks to fulfill the requirement:

  • Mimicking a chart legend by a table with a tiny textbox in it having dynamic coloring
  • Dynamic coloring of chart points to match colors with items of the table
  • Complex layout

It is also required to change JSON data in the following way:

"assestsBreakdown": [
  {
    "assests": "Alternatives",
    "value": 20.5,
    "color": "#ec6a16"
  },
  {
    "assests": "Bonds",
    "value": 26.1,
    "color": "#004157"
  },
  {
    "assests": "Equities",
    "value": 45.3,
    "color": "#226c84"
  },
  {
    "assests": "Cash and Others",
    "value": 8,
    "color": "#76bde0"
  }
]

Thanks @ivan, we need one more enhancement here - need to show the values in 2 decimal values in legend.
So could you please help us with the solution for this.

@aspwanupsinha

This can be done by changing <<[value]>> to <<[value]:"desired_format">> in the template. The format depends on a platform being used.

For .NET, you can apply either Standard numeric format strings or Custom numeric format strings as per Outputting Expression Results in .NET.

For Java, you can apply format strings suitable for DecimalFormat as per Outputting Expression Results in Java.

Thanks for your quick response, but here we are using doughnut chart and showing the value in x axis only e.g: <<foreach [in assestsBreakdown] >> <<x[assests+" "+value] >> where assest is string name and value is numeric as suggested in this forum. So we are unable to put the formatting you suggested and even dont see any option in chart formatting to change the number in decimal format against doughnut chart.

we must have to show the 2 decimal value in chart along with legend value, do you have any alternate solution to fix this.
let me know if you need more details…

@aspwanupsinha

You may try replacing <<x[assests+" "+value]>> with <<x[assests+" "+String.format("%.2f", value)]>>. This applies to Java, as it seems like you use Java. Please let us know, if a .NET example is needed instead.