Search code examples
f#fsharpchart

F# Charting - Column chart doesn't label all column names when there are more than 9 columns


I'm trying to chart some category/count data using FSharp.Charting column charts and everything works as I expect unless the number of columns reaches 10 or more.

From http://fslab.org/FSharp.Charting/BarAndColumnCharts.html.

        let data = 
            [ "Africa", 1033043; 
              "Asia", 4166741; 
              "Europe", 732759; 
              "South America", 588649; 
              "North America", 351659; 
              "Oceania", 35838]
        let chart = Chart.Column data
        chart.ShowChart()

enter image description here

So to be clear, the code above is fine but if I add 4 more territories I don't get all the labels....

        let data = 
            [ "Africa", 1033043; 
              "Asia", 4166741; 
              "Europe", 732759; 
              "South America", 588649; 
              "North America", 351659; 
              "Oceania", 35838;
              "Africa2", 1033043; 
              "Asia2", 4166741; 
              "Europe2", 732759;
              "South America2", 456789 
              ]
        let chart = Chart.Column data
        chart.ShowChart()

enter image description here

Does anyone know how I can get all the column names to show up? I can't see anything in the docs that helps.


Solution

  • Have a look at this question: How to show labels on x axis for each element?

    In short (the important part is the Interval):

    data
        |> Chart.Column
        |> Chart.WithXAxis (LabelStyle = ChartTypes.LabelStyle(Angle = -45, Interval = 1.0))