F#Charting - 当列数超过9列时,柱形图不会标记所有列名称

时间:2016-05-23 14:32:21

标签: f# fsharpchart

我尝试使用FSharp.Charting柱形图绘制一些类别/计数数据,除非列数达到10或更多,否则一切都按预期工作。

来自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

所以要清楚,上面的代码很好,但是如果我添加4个以上的区域,我就不会所有标签....

        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

有谁知道我如何才能显示所有列名?我无法在文档中看到任何有用的内容。

1 个答案:

答案 0 :(得分:5)

看看这个问题: How to show labels on x axis for each element?

简而言之(重要的部分是 Interval ):

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