3

I have sequence of tuples containing filename and number.

I want to draw column graph where on X axis I have filenames.

My problem is that now only 3 labels (filenames) are shown under X axis. That's probably because more can't fit on screen. Or maybe X axis interval is wrong?

How to make chart display all filenames? Maybe there is a way to rotate those labels 90 degrees counterclockwise to make room for more labels?

Piotr Perak
  • 10,718
  • 9
  • 49
  • 86

1 Answers1

4

You should be able to use:

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

The angle of -45 gives a nice slope and the interval of 1.0 means nothing is excluded.

Here's a proof of concept I knocked up in FSI:

#load "C:/Somewhere/packages/FSharp.Charting.0.90.7/FSharp.Charting.fsx"
open FSharp.Charting;;

let data = 
    [
        ("Foo.jpg", 12)
        ("Bar.jpg", 22)
        ("Another.doc", 8)
        ("OneMore.txt", 15)
        ("LastOne.txt", 17)
        ("ReallyLastOne.txt", 6)
        ("Foo.jpg", 12)
        ("Bar.jpg", 22)
        ("Another.doc", 8)
        ("OneMore.txt", 15)
        ("LastOne.txt", 17)
        ("ReallyLastOne.txt", 6)
    ];;

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

enter image description here

DaveShaw
  • 52,123
  • 16
  • 112
  • 141