I'd like to sort the chart based on the numbers and the legend label too
e.g. this is from your demo code.
public List<Statistics> StatisticsDetails = new List<Statistics>
{
new Statistics { Country = "China", Users = 1409517397 },
new Statistics { Country = "India", Users = 1339180127 },
new Statistics { Country = "United States", Users = 324459463 },
new Statistics { Country = "Indonesia", Users = 263991379 },
new Statistics { Country = "Brazil", Users = 209288278 },
new Statistics { Country = "Pakistan", Users = 197015955 },
new Statistics { Country = "Nigeria", Users = 190886311 },
new Statistics { Country = "Bangladesh", Users = 164669751 },
new Statistics { Country = "Russia", Users = 143989754 },
new Statistics { Country = "Mexico", Users = 129163276 },
new Statistics { Country = "Japan", Users = 127484450 },
new Statistics { Country = "Ethiopia", Users = 104957438 },
new Statistics { Country = "Philippines", Users = 104918090 },
new Statistics { Country = "Egypt", Users = 97553151 },
new Statistics { Country = "Vietnam", Users = 95540800 },
new Statistics { Country = "Germany", Users = 82114224 },
};
}This is the result image
What I'd like to do is that as the China has the most population, I like to display it on the top, and then India,,,
The Legend Lebel also needs to be based on the number. [China on the top, then India,,,]
|
<SfAccumulationChart>
<AccumulationChartEvents OnLegendItemRender="LegendRenderEvent"></AccumulationChartEvents>
</SfAccumulationChart>
@code{
public int Count = 0;
protected override void OnInitialized()
{
FunnelChartPoints = FunnelChartPoints.OrderBy(o=>o.Population).ToList();
}
public String[] LegendNames = new String[] {"China", "India", "United States","Indonesia", "Brazil" };
public String[] Colors = new String[] {"#ff6ea6", "#7ddf1e","#55a5c2", "#f7ce69", "#a16ee5" };
public void LegendRenderEvent(AccumulationLegendRenderEventArgs args)
{
Console.WriteLine(LegendNames);
if(Count >= LegendNames.Length)
Count = 0;
args.Text = LegendNames[Count];
args.Fill = Colors[Count];
Count = Count + 1;
}
} |
Hi Durga,
Thanks for your help,
But there are still some issues with above solution,
Hi Durga,
Thanks for the update new!
I just updated to latest version and Reverse work well!
Thanks ;)