Skip to content

Candlestick example in C# #297

Closed
Closed
@dharmatech

Description

@dharmatech

I have a simple program that uses Plotly.NET to create a candlestick chart of S&P 500 data:

https://github.com/dharmatech/PlotlyNetCandlestickCsv/blob/master/PlotlyNetCandlestickCsv/Program.cs

The output in a browser window is as follows:

image

Questions

Tuple.Create vs C# tuples

Note that here I had to use Tuple.Create instead of a native C# tuple:

var seq = items.Select(elt =>
    Tuple.Create(
        elt.DateTime,
        StockData.Create((double)elt.Open, (double)elt.High, (double)elt.Low, (double)elt.Close)
    ));

Will we be able to use C# tuples after #296 is implemented?

WithYAxis

Note that the call to WithYAxis is currently quite verbose:

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

Are there plans to make this more concise as part of #296?

Responsive layout vs hardcoded

I currently have the chart size hardcoded via:

.WithSize(1800, 900)

It would be nice to have the chart resize based on the size of the browser window. I added the following:

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

but it doesn't seem to have the intended effect.

Zoom with mouse wheel

Is there a way to enable zoom via the mouse wheel?

Comments

Any suggestions regarding making the example a more idiomatic demonstration of Plotly.NET are welcome. 🙂

Thank you for Plotly.NET.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions