In [1]:
require 'daru/view'
Install the spreadsheet gem version ~>1.1.1 for using spreadsheet functions.

Install the mechanize gem version ~>2.7.5 for using mechanize functions.
Out[1]:
true
In [2]:
Daru::View.plotting_library = :highcharts
Out[2]:
:highcharts
In [3]:
# line with markers and shadow

    opts = {
        rangeSelector: {
            selected: 1
        },

        title: {
            text: 'AAPL Stock Price'
        },
        plotOptions: {
            series: {
                marker: {
                    enabled: true,
                    radius: 3
                },
                shadow: true,
                tooltip: {
                    valueDecimals: 2
                }
            }
        }
    }

    data = [
             [1147651200000,67.79],
             [1147737600000,64.98],
             [1147824000000,65.26],

             [1149120000000,62.17],
             [1149206400000,61.66],
             [1149465600000,60.00],
             [1149552000000,59.72],

             [1157932800000,72.50],
             [1158019200000,72.63],
             [1158105600000,74.20],
             [1158192000000,74.17],
             [1158278400000,74.10],
             [1158537600000,73.89],

             [1170288000000,84.74],
             [1170374400000,84.75],

             [1174953600000,95.46],
             [1175040000000,93.24],
             [1175126400000,93.75],
             [1175212800000,92.91],

             [1180051200000,113.62],
             [1180396800000,114.35],
             [1180483200000,118.77],
             [1180569600000,121.19],
          ]

    df = Daru::DataFrame.new(
      {
        data1: data.map {|row| row[0]},
        data2: data.map {|row| row[1]}
      }
    )

line_series_shadow_markers = Daru::View::Plot.new(df, opts, chart_class: 'stock')
line_series_shadow_markers.show_in_iruby
Out[3]:
In [4]:
# Spline Highstock   

    opts = {
        chart: {
          type: 'spline'
        },
        rangeSelector: {
            selected: 1
        },

        title: {
            text: 'AAPL Stock Price'
        },
        tooltip: {
            valueDecimals: 2
        }
          
    }

    data = [
             [1147651200000,67.79],
             [1147737600000,64.98],
             [1147824000000,65.26],

             [1149120000000,62.17],
             [1149206400000,61.66],
             [1149465600000,60.00],
             [1149552000000,59.72],

             [1157932800000,72.50],
             [1158019200000,72.63],
             [1158105600000,74.20],
             [1158192000000,74.17],
             [1158278400000,74.10],
             [1158537600000,73.89],

             [1170288000000,84.74],
             [1170374400000,84.75],

             [1174953600000,95.46],
             [1175040000000,93.24],
             [1175126400000,93.75],
             [1175212800000,92.91],

             [1180051200000,113.62],
             [1180396800000,114.35],
             [1180483200000,118.77],
             [1180569600000,121.19],
          ]

    df = Daru::DataFrame.new(
      {
        data1: data.map {|row| row[0]},
        data2: data.map {|row| row[1]}
      }
    )

spline = Daru::View::Plot.new(df, opts, chart_class: 'stock')
spline.show_in_iruby
Out[4]:
In [5]:
# Step line Highstock   

    opts = {
        rangeSelector: {
            selected: 1
        },

        title: {
            text: 'AAPL Stock Price'
        },
        plotOptions: {
          series: {
              step: true,
              tooltip: {
                  valueDecimals: 2
              }
            }
        }
    }

    data =  [
             [1147651200000,67.79],
             [1147737600000,64.98],
             [1147824000000,65.26],

             [1149120000000,62.17],
             [1149206400000,61.66],
             [1149465600000,60.00],
             [1149552000000,59.72],

             [1157932800000,72.50],
             [1158019200000,72.63],
             [1158105600000,74.20],
             [1158192000000,74.17],
             [1158278400000,74.10],
             [1158537600000,73.89],

             [1170288000000,84.74],
             [1170374400000,84.75],

             [1174953600000,95.46],
             [1175040000000,93.24],
             [1175126400000,93.75],
             [1175212800000,92.91],

             [1180051200000,113.62],
             [1180396800000,114.35],
             [1180483200000,118.77],
             [1180569600000,121.19],
          ]

    df = Daru::DataFrame.new(
      {
        data1: data.map {|row| row[0]},
        data2: data.map {|row| row[1]}
      }
    )

spline = Daru::View::Plot.new(df, opts, chart_class: 'stock')
spline.show_in_iruby
Out[5]:
In [6]:
# Area Highstock   

    opts = {
        chart: {
          type: 'area'
        },
        rangeSelector: {
            selected: 1
        },

        title: {
            text: 'AAPL Stock Price'
        },
        plotOptions: {
          series: {
              threshold: nil,
              tooltip: {
                  valueDecimals: 2
              },
              fillColor: "{
                  linearGradient: {
                      x1: 0,
                      y1: 0,
                      x2: 0,
                      y2: 1
                  },
                  stops: [
                      [0, Highcharts.getOptions().colors[0]],
                      [1, Highcharts.Color(Highcharts.getOptions().colors[0]).setOpacity(0).get('rgba')]
                  ]
              }".js_code
          }
        }
    }

    data = [
             [1147651200000,67.79],
             [1147737600000,64.98],
             [1147824000000,65.26],

             [1149120000000,62.17],
             [1149206400000,61.66],
             [1149465600000,60.00],
             [1149552000000,59.72],

             [1157932800000,72.50],
             [1158019200000,72.63],
             [1158105600000,74.20],
             [1158192000000,74.17],
             [1158278400000,74.10],
             [1158537600000,73.89],

             [1170288000000,84.74],
             [1170374400000,84.75],

             [1174953600000,95.46],
             [1175040000000,93.24],
             [1175126400000,93.75],
             [1175212800000,92.91],

             [1180051200000,113.62],
             [1180396800000,114.35],
             [1180483200000,118.77],
             [1180569600000,121.19]
          ]

    df = Daru::DataFrame.new(
      {
        data1: data.map {|row| row[0]},
        data2: data.map {|row| row[1]}
      }
    )

area = Daru::View::Plot.new(df, opts, chart_class: 'stock')
area.show_in_iruby
Out[6]:
In [7]:
# Area Highstock   

    opts = {
        chart: {
          type: 'areaspline'
        },
        rangeSelector: {
            selected: 1
        },

        title: {
            text: 'AAPL Stock Price'
        },
        plotOptions: {
          series: {
              threshold: nil,
              tooltip: {
                  valueDecimals: 2
              },
              fillColor: "{
                  linearGradient: {
                      x1: 0,
                      y1: 0,
                      x2: 0,
                      y2: 1
                  },
                  stops: [
                      [0, Highcharts.getOptions().colors[0]],
                      [1, Highcharts.Color(Highcharts.getOptions().colors[0]).setOpacity(0).get('rgba')]
                  ]
              }".js_code
          }
        }
    }

    data = [
             [1147651200000,67.79],
             [1147737600000,64.98],
             [1147824000000,65.26],

             [1149120000000,62.17],
             [1149206400000,61.66],
             [1149465600000,60.00],
             [1149552000000,59.72],

             [1157932800000,72.50],
             [1158019200000,72.63],
             [1158105600000,74.20],
             [1158192000000,74.17],
             [1158278400000,74.10],
             [1158537600000,73.89],

             [1170288000000,84.74],
             [1170374400000,84.75],

             [1174953600000,95.46],
             [1175040000000,93.24],
             [1175126400000,93.75],
             [1175212800000,92.91],

             [1180051200000,113.62],
             [1180396800000,114.35],
             [1180483200000,118.77],
             [1180569600000,121.19]
          ]

    df = Daru::DataFrame.new(
      {
        data1: data.map {|row| row[0]},
        data2: data.map {|row| row[1]}
      }
    )

area = Daru::View::Plot.new(df, opts, chart_class: 'stock')
area.show_in_iruby
Out[7]:
In [8]:
# Area range Highstock   

    opts = {
        chart: {
            type: 'arearange'
        },
        rangeSelector: {
            selected: 2
        },

        title: {
            text: 'Temperature variation by day'
        },

        tooltip: {
            valueSuffix: '°C'
        }
    }

    user_opts = {
      chart_class: 'stock',
      modules: ['highcharts-more']
    }

    data = [
            [1483232400000, 1.4, 4.7],
            [1483318800000, -1.3, 1.9],
            [1483405200000, -0.7, 4.3],
            [1483491600000, -5.5, 3.2],
            [1483578000000, -9.9, -6.6],
            [1483664400000, -9.6, 0.1],
            [1483750800000, -0.9, 4.0],
            [1497571200000, 12.3, 14.9],
            [1497657600000, 10.5, 15.1],
            [1497744000000, 11.4, 18.0],
            [1497830400000, 9.9, 14.8],
            [1497916800000, 8.1, 12.4],
            [1498003200000, 8.6, 15.5],
            [1498089600000, 9.4, 13.0],
            [1498176000000, 11.2, 13.0],
            [1498262400000, 9.0, 15.3],
            [1498348800000, 7.7, 13.6],
            [1498435200000, 10.3, 13.6],
            [1498521600000, 6.3, 18.0],
            [1505347200000, 5.1, 15.3],
            [1505433600000, 6.7, 16.8],
            [1505520000000, 4.0, 16.1],
            [1505606400000, 3.5, 15.8],
            [1505692800000, 8.1, 12.7],
            [1505779200000, 10.4, 13.4],
            [1514163600000, 1.0, 3.1],
            [1514250000000, 1.3, 1.6],
            [1514336400000, 0.8, 1.3],
            [1514422800000, -3.3, -1.4],
            [1514509200000, -1.5, -0.2],
            [1514595600000, -2.7, -1.0],
            [1514682000000, -2.8, 0.3]
        ]

    df = Daru::DataFrame.new(
      {
        data1: data.map {|row| row[0]},
        data2: data.map {|row| row[1]},
        data3: data.map {|row| row[2]}
      }
    )

area_range = Daru::View::Plot.new(df, opts, user_opts)
area_range.show_in_iruby
Out[8]:
In [9]:
# Area range Highstock   

    opts = {
        chart: {
            type: 'areasplinerange'
        },
        rangeSelector: {
            selected: 2
        },

        title: {
            text: 'Temperature variation by day'
        },

        tooltip: {
            valueSuffix: '°C'
        }
    }

    data = [
            [1483232400000, 1.4, 4.7],
            [1483318800000, -1.3, 1.9],
            [1483405200000, -0.7, 4.3],
            [1483491600000, -5.5, 3.2],
            [1483578000000, -9.9, -6.6],
            [1483664400000, -9.6, 0.1],
            [1483750800000, -0.9, 4.0],
            [1497571200000, 12.3, 14.9],
            [1497657600000, 10.5, 15.1],
            [1497744000000, 11.4, 18.0],
            [1497830400000, 9.9, 14.8],
            [1497916800000, 8.1, 12.4],
            [1498003200000, 8.6, 15.5],
            [1498089600000, 9.4, 13.0],
            [1498176000000, 11.2, 13.0],
            [1498262400000, 9.0, 15.3],
            [1498348800000, 7.7, 13.6],
            [1498435200000, 10.3, 13.6],
            [1498521600000, 6.3, 18.0],
            [1505347200000, 5.1, 15.3],
            [1505433600000, 6.7, 16.8],
            [1505520000000, 4.0, 16.1],
            [1505606400000, 3.5, 15.8],
            [1505692800000, 8.1, 12.7],
            [1505779200000, 10.4, 13.4],
            [1514163600000, 1.0, 3.1],
            [1514250000000, 1.3, 1.6],
            [1514336400000, 0.8, 1.3],
            [1514422800000, -3.3, -1.4],
            [1514509200000, -1.5, -0.2],
            [1514595600000, -2.7, -1.0],
            [1514682000000, -2.8, 0.3]
        ]
  
    df = Daru::DataFrame.new(
      {
        data1: data.map {|row| row[0]},
        data2: data.map {|row| row[1]},
        data3: data.map {|row| row[2]}
      }
    )

area_range = Daru::View::Plot.new(df, opts, chart_class: 'stock')
area_range.show_in_iruby
Out[9]:
In [10]:
# Candle Stick

    opts = {
        rangeSelector: {
            selected: 1
        },
        chart: {
            type: 'candlestick'
        },

        title: {
            text: 'AAPL Stock Price'
        },
        plotOptions: {
          series: {
              dataGrouping: "{
                units: [
                    [
                        'week', // unit name
                        [1] // allowed multiples
                    ], [
                        'month',
                        [1, 2, 3, 4, 6]
                    ]
                ]
            }".js_code
          }
        }
    }

    data = [
            [1294617600000,48.40,49.03,48.17,48.92],
            [1294704000000,49.27,49.28,48.50,48.81],
            [1294790400000,49.04,49.20,48.86,49.20],
            [1294876800000,49.31,49.52,49.12,49.38],
            [1294963200000,49.41,49.78,49.21,49.78],
            [1295308800000,47.07,49.25,46.57,48.66],
            [1295395200000,49.76,49.80,48.13,48.41],
            [1295481600000,48.06,48.33,47.16,47.53],
            [1295568000000,47.68,47.84,46.66,46.67],
            [1295827200000,46.70,48.21,46.67,48.21],
            [1295913600000,48.05,48.78,47.80,48.77],
            [1296000000000,48.99,49.37,48.79,49.12],
            [1296086400000,49.11,49.24,48.98,49.03],
            [1296172800000,49.17,49.20,47.65,48.01],
            [1296432000000,47.97,48.58,47.76,48.47],

            [1309478400000,47.99,49.07,47.74,49.04],
            [1309824000000,49.00,49.98,48.93,49.92],
            [1309910400000,49.85,50.59,49.53,50.25],
            [1309996800000,50.67,51.14,50.57,51.03],
            [1310083200000,50.48,51.43,50.31,51.39],
            [1310342400000,50.91,51.40,50.40,50.57],
            [1310428800000,50.50,51.10,49.80,50.54],
            [1310515200000,51.19,51.43,50.91,51.15],
            [1310601600000,51.57,51.66,50.91,51.11],
            [1310688000000,51.60,52.14,51.31,52.13],
            [1310947200000,52.20,53.52,52.18,53.40],
            [1311033600000,54.00,54.09,53.33,53.84],
            [1311120000000,56.59,56.61,55.14,55.27],
            [1311206400000,55.28,55.72,54.84,55.33],
            [1311292800000,55.47,56.44,55.39,56.19],
            [1311552000000,55.76,57.14,55.66,56.93],
            [1311638400000,57.14,57.79,57.10,57.63],
            [1311724800000,57.23,57.52,56.02,56.08],
            [1311811200000,55.95,56.71,55.45,55.97],
            [1311897600000,55.38,56.45,54.86,55.78],

            [1417392000000,118.81,119.25,111.27,115.07],
            [1417478400000,113.50,115.75,112.75,114.63],
            [1417564800000,115.75,116.35,115.11,115.93],
            [1417651200000,115.77,117.20,115.29,115.49],
            [1417737600000,115.99,116.08,114.64,115.00],
            [1417996800000,114.10,114.65,111.62,112.40],
            [1418083200000,110.19,114.30,109.35,114.12],
            [1418169600000,114.41,114.85,111.54,111.95],
            [1418256000000,112.26,113.80,111.34,111.62],
            [1418342400000,110.46,111.87,109.58,109.73],
            [1418601600000,110.70,111.60,106.35,108.22],
            [1418688000000,106.37,110.16,106.26,106.74],
            [1418774400000,107.12,109.84,106.82,109.41],
            [1418860800000,111.87,112.65,110.66,112.65],
            [1418947200000,112.26,113.24,111.66,111.78],
            [1419206400000,112.16,113.49,111.97,112.94],
            [1419292800000,113.23,113.33,112.46,112.54],
            [1419379200000,112.58,112.71,112.01,112.01],
            [1419552000000,112.10,114.52,112.01,113.99],
            [1419811200000,113.79,114.77,113.70,113.91],
            [1419897600000,113.64,113.92,112.11,112.52],
            [1419984000000,112.82,113.13,110.21,110.38],

            [1514851200000,170.16,172.30,169.26,172.26],
            [1514937600000,172.53,174.55,171.96,172.23],
            [1515024000000,172.54,173.47,172.08,173.03],
            [1515110400000,173.44,175.37,173.05,175.00]
        ]

candle_stick = Daru::View::Plot.new(data, opts, chart_class: 'stock')
candle_stick.show_in_iruby
Out[10]:
In [11]:
# ohlc Stick

    opts = {
        rangeSelector: {
            selected: 1
        },
        chart: {
            type: 'ohlc'
        },

        title: {
            text: 'AAPL Stock Price'
        },
        plotOptions: {
          series: {
              dataGrouping: "{
                units: [
                    [
                        'week', // unit name
                        [1] // allowed multiples
                    ], [
                        'month',
                        [1, 2, 3, 4, 6]
                    ]
                ]
            }".js_code
          }
        }
    }

    data = [
            [1294617600000,48.40,49.03,48.17,48.92],
            [1294704000000,49.27,49.28,48.50,48.81],
            [1294790400000,49.04,49.20,48.86,49.20],
            [1294876800000,49.31,49.52,49.12,49.38],
            [1294963200000,49.41,49.78,49.21,49.78],
            [1295308800000,47.07,49.25,46.57,48.66],
            [1295395200000,49.76,49.80,48.13,48.41],
            [1295481600000,48.06,48.33,47.16,47.53],
            [1295568000000,47.68,47.84,46.66,46.67],
            [1295827200000,46.70,48.21,46.67,48.21],
            [1295913600000,48.05,48.78,47.80,48.77],
            [1296000000000,48.99,49.37,48.79,49.12],
            [1296086400000,49.11,49.24,48.98,49.03],
            [1296172800000,49.17,49.20,47.65,48.01],
            [1296432000000,47.97,48.58,47.76,48.47],

            [1309478400000,47.99,49.07,47.74,49.04],
            [1309824000000,49.00,49.98,48.93,49.92],
            [1309910400000,49.85,50.59,49.53,50.25],
            [1309996800000,50.67,51.14,50.57,51.03],
            [1310083200000,50.48,51.43,50.31,51.39],
            [1310342400000,50.91,51.40,50.40,50.57],
            [1310428800000,50.50,51.10,49.80,50.54],
            [1310515200000,51.19,51.43,50.91,51.15],
            [1310601600000,51.57,51.66,50.91,51.11],
            [1310688000000,51.60,52.14,51.31,52.13],
            [1310947200000,52.20,53.52,52.18,53.40],
            [1311033600000,54.00,54.09,53.33,53.84],
            [1311120000000,56.59,56.61,55.14,55.27],
            [1311206400000,55.28,55.72,54.84,55.33],
            [1311292800000,55.47,56.44,55.39,56.19],
            [1311552000000,55.76,57.14,55.66,56.93],
            [1311638400000,57.14,57.79,57.10,57.63],
            [1311724800000,57.23,57.52,56.02,56.08],
            [1311811200000,55.95,56.71,55.45,55.97],
            [1311897600000,55.38,56.45,54.86,55.78],

            [1417392000000,118.81,119.25,111.27,115.07],
            [1417478400000,113.50,115.75,112.75,114.63],
            [1417564800000,115.75,116.35,115.11,115.93],
            [1417651200000,115.77,117.20,115.29,115.49],
            [1417737600000,115.99,116.08,114.64,115.00],
            [1417996800000,114.10,114.65,111.62,112.40],
            [1418083200000,110.19,114.30,109.35,114.12],
            [1418169600000,114.41,114.85,111.54,111.95],
            [1418256000000,112.26,113.80,111.34,111.62],
            [1418342400000,110.46,111.87,109.58,109.73],
            [1418601600000,110.70,111.60,106.35,108.22],
            [1418688000000,106.37,110.16,106.26,106.74],
            [1418774400000,107.12,109.84,106.82,109.41],
            [1418860800000,111.87,112.65,110.66,112.65],
            [1418947200000,112.26,113.24,111.66,111.78],
            [1419206400000,112.16,113.49,111.97,112.94],
            [1419292800000,113.23,113.33,112.46,112.54],
            [1419379200000,112.58,112.71,112.01,112.01],
            [1419552000000,112.10,114.52,112.01,113.99],
            [1419811200000,113.79,114.77,113.70,113.91],
            [1419897600000,113.64,113.92,112.11,112.52],
            [1419984000000,112.82,113.13,110.21,110.38],

            [1514851200000,170.16,172.30,169.26,172.26],
            [1514937600000,172.53,174.55,171.96,172.23],
            [1515024000000,172.54,173.47,172.08,173.03],
            [1515110400000,173.44,175.37,173.05,175.00]
        ]

ohlc = Daru::View::Plot.new(data, opts, chart_class: 'stock')
ohlc.show_in_iruby
Out[11]:
In [12]:
# column

    opts = {
        rangeSelector: {
            selected: 1
        },
        chart: {
            type: 'column'
        },

        title: {
            text: 'AAPL Stock Price'
        },
        plotOptions: {
          series: {
              dataGrouping: "{
                units: [
                    [
                        'week', // unit name
                        [1] // allowed multiples
                    ], [
                        'month',
                        [1, 2, 3, 4, 6]
                    ]
                ]
            }".js_code
          }
        }
    }

    data = [
            [1294617600000,48.40,49.03,48.17,48.92],
            [1294704000000,49.27,49.28,48.50,48.81],
            [1294790400000,49.04,49.20,48.86,49.20],
            [1294876800000,49.31,49.52,49.12,49.38],
            [1294963200000,49.41,49.78,49.21,49.78],
            [1295308800000,47.07,49.25,46.57,48.66],
            [1295395200000,49.76,49.80,48.13,48.41],
            [1295481600000,48.06,48.33,47.16,47.53],
            [1295568000000,47.68,47.84,46.66,46.67],
            [1295827200000,46.70,48.21,46.67,48.21],
            [1295913600000,48.05,48.78,47.80,48.77],
            [1296000000000,48.99,49.37,48.79,49.12],
            [1296086400000,49.11,49.24,48.98,49.03],
            [1296172800000,49.17,49.20,47.65,48.01],
            [1296432000000,47.97,48.58,47.76,48.47],

            [1309478400000,47.99,49.07,47.74,49.04],
            [1309824000000,49.00,49.98,48.93,49.92],
            [1309910400000,49.85,50.59,49.53,50.25],
            [1309996800000,50.67,51.14,50.57,51.03],
            [1310083200000,50.48,51.43,50.31,51.39],
            [1310342400000,50.91,51.40,50.40,50.57],
            [1310428800000,50.50,51.10,49.80,50.54],
            [1310515200000,51.19,51.43,50.91,51.15],
            [1310601600000,51.57,51.66,50.91,51.11],
            [1310688000000,51.60,52.14,51.31,52.13],
            [1310947200000,52.20,53.52,52.18,53.40],
            [1311033600000,54.00,54.09,53.33,53.84],
            [1311120000000,56.59,56.61,55.14,55.27],
            [1311206400000,55.28,55.72,54.84,55.33],
            [1311292800000,55.47,56.44,55.39,56.19],
            [1311552000000,55.76,57.14,55.66,56.93],
            [1311638400000,57.14,57.79,57.10,57.63],
            [1311724800000,57.23,57.52,56.02,56.08],
            [1311811200000,55.95,56.71,55.45,55.97],
            [1311897600000,55.38,56.45,54.86,55.78],

            [1417392000000,118.81,119.25,111.27,115.07],
            [1417478400000,113.50,115.75,112.75,114.63],
            [1417564800000,115.75,116.35,115.11,115.93],
            [1417651200000,115.77,117.20,115.29,115.49],
            [1417737600000,115.99,116.08,114.64,115.00],
            [1417996800000,114.10,114.65,111.62,112.40],
            [1418083200000,110.19,114.30,109.35,114.12],
            [1418169600000,114.41,114.85,111.54,111.95],
            [1418256000000,112.26,113.80,111.34,111.62],
            [1418342400000,110.46,111.87,109.58,109.73],
            [1418601600000,110.70,111.60,106.35,108.22],
            [1418688000000,106.37,110.16,106.26,106.74],
            [1418774400000,107.12,109.84,106.82,109.41],
            [1418860800000,111.87,112.65,110.66,112.65],
            [1418947200000,112.26,113.24,111.66,111.78],
            [1419206400000,112.16,113.49,111.97,112.94],
            [1419292800000,113.23,113.33,112.46,112.54],
            [1419379200000,112.58,112.71,112.01,112.01],
            [1419552000000,112.10,114.52,112.01,113.99],
            [1419811200000,113.79,114.77,113.70,113.91],
            [1419897600000,113.64,113.92,112.11,112.52],
            [1419984000000,112.82,113.13,110.21,110.38],

            [1514851200000,170.16,172.30,169.26,172.26],
            [1514937600000,172.53,174.55,171.96,172.23],
            [1515024000000,172.54,173.47,172.08,173.03],
            [1515110400000,173.44,175.37,173.05,175.00]
        ]

column = Daru::View::Plot.new(data, opts, chart_class: 'stock')
column.show_in_iruby
Out[12]:
In [13]:
# Column range Highstock   

    opts = {
        chart: {
            type: 'columnrange'
        },

        rangeSelector: {
            selected: 2
        },

        title: {
            text: 'Temperature variation by day'
        },

        tooltip: {
            valueSuffix: '°C'
        }
    }

    data = [
            [1483232400000, 1.4, 4.7],
            [1483318800000, -1.3, 1.9],
            [1483405200000, -0.7, 4.3],
            [1483491600000, -5.5, 3.2],
            [1483578000000, -9.9, -6.6],
            [1483664400000, -9.6, 0.1],
            [1483750800000, -0.9, 4.0],
            [1497571200000, 12.3, 14.9],
            [1497657600000, 10.5, 15.1],
            [1497744000000, 11.4, 18.0],
            [1497830400000, 9.9, 14.8],
            [1497916800000, 8.1, 12.4],
            [1498003200000, 8.6, 15.5],
            [1498089600000, 9.4, 13.0],
            [1498176000000, 11.2, 13.0],
            [1498262400000, 9.0, 15.3],
            [1498348800000, 7.7, 13.6],
            [1498435200000, 10.3, 13.6],
            [1498521600000, 6.3, 18.0],
            [1505347200000, 5.1, 15.3],
            [1505433600000, 6.7, 16.8],
            [1505520000000, 4.0, 16.1],
            [1505606400000, 3.5, 15.8],
            [1505692800000, 8.1, 12.7],
            [1505779200000, 10.4, 13.4],
            [1514163600000, 1.0, 3.1],
            [1514250000000, 1.3, 1.6],
            [1514336400000, 0.8, 1.3],
            [1514422800000, -3.3, -1.4],
            [1514509200000, -1.5, -0.2],
            [1514595600000, -2.7, -1.0],
            [1514682000000, -2.8, 0.3]
        ]

    df = Daru::DataFrame.new(
      {
        data1: data.map {|row| row[0]},
        data2: data.map {|row| row[1]},
        data3: data.map {|row| row[2]}
      }
    )


column_range = Daru::View::Plot.new(df, opts, chart_class: 'stock')
column_range.show_in_iruby
Out[13]:
In [14]:
# Point markers only

    opts = {
        rangeSelector: {
            selected: 2
        },

        title: {
            text: 'AAPL Stock Price'
        },
      
        plotOptions: {
            series: {
                lineWidth: 0,
                marker: {
                    enabled: true,
                    radius: 2
                },
                tooltip: {
                    valueDecimals: 2
                },
                states: {
                    hover: {
                        lineWidthPlus: 0
                    }
                }
            }
        }
    }

    data = [
            [1294617600000,48.40,49.03,48.17,48.92],
            [1294704000000,49.27,49.28,48.50,48.81],
            [1294790400000,49.04,49.20,48.86,49.20],
            [1294876800000,49.31,49.52,49.12,49.38],
            [1294963200000,49.41,49.78,49.21,49.78],
            [1295308800000,47.07,49.25,46.57,48.66],
            [1295395200000,49.76,49.80,48.13,48.41],
            [1295481600000,48.06,48.33,47.16,47.53],
            [1295568000000,47.68,47.84,46.66,46.67],
            [1295827200000,46.70,48.21,46.67,48.21],
            [1295913600000,48.05,48.78,47.80,48.77],
            [1296000000000,48.99,49.37,48.79,49.12],
            [1296086400000,49.11,49.24,48.98,49.03],
            [1296172800000,49.17,49.20,47.65,48.01],
            [1296432000000,47.97,48.58,47.76,48.47],

            [1309478400000,47.99,49.07,47.74,49.04],
            [1309824000000,49.00,49.98,48.93,49.92],
            [1309910400000,49.85,50.59,49.53,50.25],
            [1309996800000,50.67,51.14,50.57,51.03],
            [1310083200000,50.48,51.43,50.31,51.39],
            [1310342400000,50.91,51.40,50.40,50.57],
            [1310428800000,50.50,51.10,49.80,50.54],
            [1310515200000,51.19,51.43,50.91,51.15],
            [1310601600000,51.57,51.66,50.91,51.11],
            [1310688000000,51.60,52.14,51.31,52.13],
            [1310947200000,52.20,53.52,52.18,53.40],
            [1311033600000,54.00,54.09,53.33,53.84],
            [1311120000000,56.59,56.61,55.14,55.27],
            [1311206400000,55.28,55.72,54.84,55.33],
            [1311292800000,55.47,56.44,55.39,56.19],
            [1311552000000,55.76,57.14,55.66,56.93],
            [1311638400000,57.14,57.79,57.10,57.63],
            [1311724800000,57.23,57.52,56.02,56.08],
            [1311811200000,55.95,56.71,55.45,55.97],
            [1311897600000,55.38,56.45,54.86,55.78],

            [1417392000000,118.81,119.25,111.27,115.07],
            [1417478400000,113.50,115.75,112.75,114.63],
            [1417564800000,115.75,116.35,115.11,115.93],
            [1417651200000,115.77,117.20,115.29,115.49],
            [1417737600000,115.99,116.08,114.64,115.00],
            [1417996800000,114.10,114.65,111.62,112.40],
            [1418083200000,110.19,114.30,109.35,114.12],
            [1418169600000,114.41,114.85,111.54,111.95],
            [1418256000000,112.26,113.80,111.34,111.62],
            [1418342400000,110.46,111.87,109.58,109.73],
            [1418601600000,110.70,111.60,106.35,108.22],
            [1418688000000,106.37,110.16,106.26,106.74],
            [1418774400000,107.12,109.84,106.82,109.41],
            [1418860800000,111.87,112.65,110.66,112.65],
            [1418947200000,112.26,113.24,111.66,111.78],
            [1419206400000,112.16,113.49,111.97,112.94],
            [1419292800000,113.23,113.33,112.46,112.54],
            [1419379200000,112.58,112.71,112.01,112.01],
            [1419552000000,112.10,114.52,112.01,113.99],
            [1419811200000,113.79,114.77,113.70,113.91],
            [1419897600000,113.64,113.92,112.11,112.52],
            [1419984000000,112.82,113.13,110.21,110.38],

            [1514851200000,170.16,172.30,169.26,172.26],
            [1514937600000,172.53,174.55,171.96,172.23],
            [1515024000000,172.54,173.47,172.08,173.03],
            [1515110400000,173.44,175.37,173.05,175.00]
        ]

point_markers = Daru::View::Plot.new(data, opts, chart_class: 'stock')
point_markers.show_in_iruby
Out[14]:
In [ ]: