Sha256: 25a1445817de8679bb619c52091bb096895267acc05a709bb2df4ddcc9cb276f
Contents?: true
Size: 1.88 KB
Versions: 2
Compression:
Stored size: 1.88 KB
Contents
%div %div %div %canvas(id="canvas" height="450" width="800") - sales_value = ->(h) { h[:sales].to_i } :javascript //Chart.defaults.global.multiTooltipTemplate = "<%= datasetLabel %>: <%= value %>"; Chart.defaults.global.hover.mode = 'label'; Chart.defaults.global.tooltips.mode = 'label'; var salesData = { labels : [#{plot_data.values.map{|v| "'#{v[:label].to_s}'"}.join(',')}], datasets : [ { label: "Product sales", fill: false, lineTension: 0.2, borderColor: "rgba(75,192,142,1)", borderCapStyle: 'round', pointBorderColor: "rgba(75,142,112,1)", pointBackgroundColor: "#fff", pointBorderWidth: 1, pointHoverRadius: 8, pointHoverBackgroundColor: "rgba(75,192,192,1)", pointHoverBorderColor: "rgba(220,220,220,1)", pointHoverBorderWidth: 2, pointRadius: 2, pointHitRadius: 10, data : [#{plot_data.values.map(&sales_value).join(',')}] }, { label: "Product stock", fill: true, lineTension: 0.2, backgroundColor: "rgba(175,155,155,0.4)", borderColor: "rgba(105,112,172,1)", borderCapStyle: 'round', pointBorderColor: "rgba(155,152,182,1)", pointBackgroundColor: "#fff", pointBorderWidth: 1, pointHoverRadius: 8, pointHoverBackgroundColor: "rgba(99,102,152,1)", pointHoverBorderColor: "rgba(210,210,210,1)", pointHoverBorderWidth: 2, pointRadius: 2, pointHitRadius: 10, data : [#{plot_data.values.map{|v| v[:stock].nil? ? 'null' : v[:stock].to_i}.join(',')}] /*data : [#{plot_data.values.map{|v| v[:stock].to_i}.join(',')}]*/ } ] } var ctx = document.getElementById("canvas").getContext("2d"); window.myLine = new Chart(ctx, { type: 'line', data: salesData, options: {}, responsive: true, });
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rawbotz-0.1.3 | lib/rawbotz/views/product/_stock_sales_plot.haml |
rawbotz-0.1.2 | lib/rawbotz/views/product/_stock_sales_plot.haml |