Skip to content

Commit

Permalink
Merge pull request #131 from sebfia/master
Browse files Browse the repository at this point in the history
Added candlestick chart type to Gtk charting.
  • Loading branch information
dsyme authored Jun 16, 2017
2 parents b362861 + cec0708 commit c9d319b
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/FSharp.Charting.Gtk.fs
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,16 @@ namespace FSharp.Charting
member __.Y = Y
member __.Size = Size
member __.Tag = Tag
type public CandlestickChartItem(Date: key, Open: value, High: value, Low: value, Close: value) =
member __.Date = Date
member __.Open = Open
member __.High = High
member __.Low = Low
member __.Close = Close

// let mapHiLoItem (d, o, h, l, c) =
// let x = Axes.DateTimeAxis.ToDouble d
// HighLowItem(x,h,l,o,c)

#if INCOMPLETE_API
/// Specifies the image type of the chart.
Expand Down Expand Up @@ -1127,6 +1137,7 @@ namespace FSharp.Charting
GenericChart.Create(data |> listen |> makeItems (fun (x,y) -> LineChartItem(x,y)), LineSeries(DataFieldX="X",DataFieldY="Y"))
|> Helpers.ApplyStaticAxis(typeof<'key>, Axes.AxisPosition.Bottom)
|> Helpers.ApplyStyles(?Name=Name,?Title=Title,?Color=Color,?AxisXTitle=XTitle,?AxisYTitle=YTitle)


/// <summary>Illustrates trends in data with the passing of time.</summary>
/// <param name="data">The data for the chart.</param>
Expand Down Expand Up @@ -1186,6 +1197,19 @@ namespace FSharp.Charting
static member Point(data:seq<#value>,?Name,?Title,?Labels,?Color,?XTitle,?YTitle,?MarkerSize) =
Chart.Point(indexData data,?Name=Name,?Title=Title,?Color=Color,?XTitle=XTitle,?YTitle=YTitle,?MarkerSize=MarkerSize)

/// <summary>Used to display stock information using high, low, open and close values.</summary>
/// <param name="data">The data for the chart as (time, high, low, open, close) tuples.</param>
/// <param name="Name">The name of the data set.</param>
/// <param name="Title">The title of the chart.</param>
/// <param name="Labels">The labels that match the data.</param>
/// <param name="Color">The color for the data.</param>
/// <param name="XTitle">The title of the X-axis.</param>
/// <param name="YTitle">The title of the Y-axis.</param>
static member Candlestick(data:seq<('key :> key) * #value * #value * #value * #value>,?Name,?Title,?Color,?XTitle,?YTitle) =
GenericChart.Create(data |> listen |> makeItems (fun(d,o,h,l,c) -> CandlestickChartItem(d |> Axes.DateTimeAxis.ToDouble,o,h,l,c)), CandleStickSeries(DataFieldX = "Date", DataFieldOpen = "Open", DataFieldHigh = "High", DataFieldLow = "Low", DataFieldClose = "Close"))
|> Helpers.ApplyStaticAxis(typeof<'key>, Axes.AxisPosition.Bottom)
|> Helpers.ApplyStyles(?Name=Name,?Title=Title,?Color=Color,?AxisXTitle=XTitle,?AxisYTitle=YTitle)

#if INCOMPLETE_API
/// <summary>Disregards the passage of time and only displays changes in prices.</summary>
/// <param name="data">The data for the chart.</param>
Expand Down

0 comments on commit c9d319b

Please sign in to comment.