morrisjs / morris.js

Pretty time-series line graphs
http://morrisjs.github.com/morris.js/
6.92k stars 1.23k forks source link

Draw line from 0,0 upto first item data using line graph #774

Open bumbumpaw07 opened 5 years ago

bumbumpaw07 commented 5 years ago

Hello, if I only have one item in my data array, how can I draw a line from 0,0 so that may first data will not look like alone dot? See example link below.

Live Chart example

pierresh commented 5 years ago

Hello,

I am sorry this is not possible, you may just try to prepend one data { day: '-', pushups: 0 }, in your dataset

bumbumpaw07 commented 5 years ago

Hi, thanks for replying. iIn that case. How can I hide the data set label on first dot only? so it will not look like like a displaying record but just as a starting dot line?

Live Chart Example

pierresh commented 5 years ago

You can try to use the function hoverCallback like this:

hoverCallback: function (index, options, content, row) {
    if (index == 0) { return false; }
    else { return content; }
}

More info about this function here: http://morrisjs.github.io/morris.js/lines.html