I have tried using d3.js (+c3.js) for visualize data. In right y-axis I need a log scale for barchart. I have followed tips from https://github.com/masayuki0812/c3/issues/252, and they worked!
But the problem is when I have data 0s in the dataset, it makes the barchart not show. I tried to handle this, by modifying the function that handles scaling like this:
for(var i=1; i<data_test_original.length; i++){
if (data_test_original[i] === 0){
data_logscale_tweet[i] = 0;
}
else {
data_logscale_tweet[i] = Math.log(data_test_original[i]) / Math.LN10;
}
}
This is my dataset:
data_test_original = ['data3', 0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,3,2,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,15,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,12,0,41,0,4,0,5,0,29,0,0,0,0,0,0,0,0,0,0,0,11,0,19,23,87,0,83,0,17,13,36,0,10,1,6,0,2,0,1,3,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,3,0,0,0,1,0,0,1,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,1,0,0,1,0,0,0,2,0,0,0,43,9,10,9,2,0,0,0,0,1,4,0,0,2,0,9,2,0,0,0,0,0,1,0,0,3,0,0,0,0,0,0,0,1,0,0,0,0,0,2,0,4,0,0,0,6,0,8,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,30,50,100]
You can view chart from this http://jsfiddle.net/paE7D/10/
You can see in this chart chart, for data values 0, values 1 are displayed in the barchart. My question is: How can I set the barchart value to 0 (not to 1), for data values 0?