Column type chart with amounts at top of the bar

I've been relying lately on LINQPads ability to create charts, and I'm really liking it, but I'm curious how I would go about placing the value of the y on the top of the bar?It's usually possible for normal charting components in a regular C# application, and was hoping I could get it in LINQPad as well?

Comments

  • The charting methods use the Windows Forms DataVisualization API. You can gain direct control over it by calling .ToWindowsChart() and then set properties as required. I think the one you want is IsValueShownAsLabel:
    var customers = new[]
    {
    	new { Name = "John", TotalOrders = 100 },
    	new { Name = "Mary", TotalOrders = 130 },
    	new { Name = "Sara", TotalOrders = 140 },
    	new { Name = "Paul", TotalOrders = 125 },
    };
    
    var chart = customers.Chart (c => c.Name, c => c.TotalOrders).ToWindowsChart();
    chart.Series.First().IsValueShownAsLabel = true;
    chart.Dump();
    
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!