diff --git a/src/html/js/entries.js b/src/html/js/entries.js
index 88916ad..2e20211 100644
--- a/src/html/js/entries.js
+++ b/src/html/js/entries.js
@@ -176,46 +176,10 @@ var ListViewModel = function() {
// We assume that entries are sorted by value date descending.
var entries = unwrap(self.entries).slice().reverse();
- // First pass: get open, high, low and close values for each day.
- var chartValuesTmp = {};
- $.each(entries, function(index, entry) {
- //var date = entry.value_date() ? entry.value_date().toString() : null;
- var date = unwrap(entry.value_date);
- var value = unwrap(entry.value) ? Number(unwrap(entry.value())) : null;
-
- if(date && value) {
- var values = {};
-
- var sold = Number(unwrap(entry.sold));
- var open = Number((sold - value).toFixed(2));
-
- values['open'] = open;
- values['high'] = sold > open ? sold : open;
- values['low'] = sold < open ? sold : open;
- values['close'] = sold;
-
- if(chartValuesTmp[date]) {
- var oldValues = chartValuesTmp[date];
-
- if(oldValues['high'] > values['high']) {
- values['high'] = oldValues['high'];
- }
-
- if(oldValues['low'] < values['low']) {
- values['low'] = oldValues['low'];
- }
-
- values['open'] = oldValues['open'];
- }
-
- chartValuesTmp[date] = values;
- }
- });
-
- // Second pass: transform to an array readable by jqplot OHLC renderer.
+ // Transform to an array readable by jqplot Line renderer.
var chartValues = [];
- $.each(chartValuesTmp, function(key, value) {
- chartValues.push([key, value['open'], value['high'], value['low'], value['close']]);
+ $.each(entries, function(index, entry) {
+ chartValues.push([unwrap(entry.value_date), Number(unwrap(entry.sold))]);
});
return chartValues;
@@ -468,6 +432,8 @@ drawChart = function(entries, element) {
var firstDate = new Date(Date.parse(entries[0][0]).valueOf() - day).format('yyyy-mm-dd');
var lastDate = new Date(Date.parse(entries[entries.length -1][0]).valueOf() + day).format('yyyy-mm-dd');
+ console.debug(entries)
+
// Plot chart, and store it in a window parameter for resize callback (need to be done better than it...)
window.chart = $.jqplot(element.id, [entries], {
// Title of the chart
@@ -499,15 +465,18 @@ drawChart = function(entries, element) {
// Highlighter parameters
highlighter: {
show: true,
- yvalues: 4,
- formatString: '
date: | %s |
open: | %s |
hi: | %s |
low: | %s |
close: | %s |
'
+ //yvalues: 4,
+ formatString: 'date: | %s |
sold: | %s |
'
},
// Series parameters
series: [{
// We use the OHLC (open, high, low, close) rendered.
- renderer:$.jqplot.OHLCRenderer,
+ //renderer:$.jqplot.OHLCRenderer,
color: "blue",
+ rendererOptions: {
+ smooth: true,
+ }
}],
// To display horizontal (0) and vertical (today) lines