Using this library "https://github.com/wcharczuk/go-chart" I want to generate pie chart using json data.
Code
pie := chart.PieChart{
Width: 512,
Height: 512,
Values: []chart.Value{
{Value: 5, Label: "Blue"},
{Value: 5, Label: "Green"},
{Value: 4, Label: "Gray"},
},
}
My Json
"reaction_summary": {
"ANGRY": 7,
"HAHA": 40,
"LIKE": 161,
"LOVE": 56,
"SAD": 26,
"SHOCK": 6
}
What I really want to achieve is this
data = Parse/map json as the content of chart.Value
pie := chart.PieChart{
Width: 512,
Height: 512,
Values: []chart.Value{
data
},
}