Make chart fill size of browser window

209 views Asked by At

Screenshot

I have a C# program which uses Plotly.NET to set up a candlestick chart of the S&P data.

It's shown below in a browser window:

enter image description here

Question

Is there a way to get it to be larger? Perhaps a way to get it to fill the window?

Responsive charts

The documentation has a section regarding Responsive charts:

enter image description here

Here's the code I'm using to setup the chart:

Chart2D.Chart.Candlestick<string>(seq)

    .WithYAxis(LinearAxis.init<IConvertible, IConvertible, IConvertible, IConvertible, IConvertible, IConvertible>(
        FixedRange: false))

    .WithConfig(Config.init(Responsive: true))

    .Show();

However, the resulting chart is still a fixed size.

Code

Here's a link to the full program, if you'd like to try it out.

1

There are 1 answers

0
dharmatech On

The size of the chart can be changed via WithSize as shown below:

Chart2D.Chart.Candlestick<string>(seq)

    .WithYAxis(LinearAxis.init<IConvertible, IConvertible, IConvertible, IConvertible, IConvertible, IConvertible>(
        FixedRange: false))

    .WithConfig(Config.init(Responsive: true))

    .WithSize(1800, 900)

    .Show();