{"action":"created","issue":{"url":"https://api.github.com/repos/chartjs/Chart.js/issues/2914","repository_url":"https://api.github.com/repos/chartjs/Chart.js","labels_url":"https://api.github.com/repos/chartjs/Chart.js/issues/2914/labels{/name}","comments_url":"https://api.github.com/repos/chartjs/Chart.js/issues/2914/comments","events_url":"https://api.github.com/repos/chartjs/Chart.js/issues/2914/events","html_url":"https://github.com/chartjs/Chart.js/issues/2914","id":163860169,"number":2914,"title":"Logarithmic-horizontal-bar chart not always showing \"0\" and wrong helper lines?","user":{"login":"aardidi","id":20298692,"avatar_url":"https://avatars.githubusercontent.com/u/20298692?v=3","gravatar_id":"","url":"https://api.github.com/users/aardidi","html_url":"https://github.com/aardidi","followers_url":"https://api.github.com/users/aardidi/followers","following_url":"https://api.github.com/users/aardidi/following{/other_user}","gists_url":"https://api.github.com/users/aardidi/gists{/gist_id}","starred_url":"https://api.github.com/users/aardidi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aardidi/subscriptions","organizations_url":"https://api.github.com/users/aardidi/orgs","repos_url":"https://api.github.com/users/aardidi/repos","events_url":"https://api.github.com/users/aardidi/events{/privacy}","received_events_url":"https://api.github.com/users/aardidi/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-07-05T14:10:34Z","updated_at":"2016-07-06T08:29:00Z","closed_at":"2016-07-06T08:19:35Z","body":"It's me again. \r\n\r\nI have a problem with a horizontal bar chart with a logarithmic x-axis - I can't seem to be able to force the chart to always show 0 on the x-axis, it always cuts a part away (unless one chart is defined as a small value like 0.1 or 1). I've tried beginAtZero to no effect.\r\n\r\n![cutoff](https://cloud.githubusercontent.com/assets/20298692/16588893/49131a7e-42d1-11e6-9d0a-bc42717d1afd.png)\r\n\r\n\r\n\r\nSecond, I can't seem to be able to figure out how to label more steps on the x-Axis, right now they are in steps of 100.\r\n\r\nThird - the helper lines aren't representing the logarithmic scale correctly (1,2, ... , 9,10), they seem to be \"summarizing\" them (2,4,6,8,10). \r\n\r\n\r\nHere is my code so far (I'm new, be gentle):\r\n\r\n\r\n```\r\nvar ctx = document.getElementById(\"myChart\");\r\nvar myChart = new Chart(ctx, {\r\n    type: 'horizontalBar',\r\n    data: {\r\n        labels: [\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\"],\r\n        datasets: [{\r\n            label: '',\r\n            data: [100, 1000, 10000, 1000, 100, 1000, 10000],\r\n            backgroundColor: [\r\n\t\t\t\t'rgba(0, 0, 0, 0)',\r\n                'rgba(0, 0, 0, 0)',\r\n                'rgba(0, 0, 0, 0)',\r\n                'rgba(0, 0, 0, 0)',\r\n                'rgba(0, 0, 0, 0)',\r\n\t\t\t\t'rgba(0, 0, 0, 0)',\r\n\t\t\t\t'rgba(0, 0, 0, 0)',\r\n            ],\r\n            borderColor: [\r\n\t\t\t\t'rgba(0, 0, 0, 0)',\r\n                'rgba(0, 0, 0, 0)',\r\n                'rgba(0, 0, 0, 0)',\r\n                'rgba(0, 0, 0, 0)',\r\n                'rgba(0, 0, 0, 0)',\r\n                'rgba(0, 0, 0, 0)',\r\n                'rgba(0, 0, 0, 0)',\r\n            ],\r\n            borderWidth: 1\r\n        },{\r\n            label: '# of Votes',\r\n            data: [100, 100000, 10000, 10000000000, 1000000, 100000, 1000],\r\n            backgroundColor: [\r\n\t\t\t\t'rgba(255, 159, 64, 0.2)',\r\n                'rgba(255, 99, 132, 0.2)',\r\n                'rgba(54, 162, 235, 0.2)',\r\n                'rgba(255, 206, 86, 0.2)',\r\n                'rgba(75, 192, 192, 0.2)',\r\n                'rgba(153, 102, 255, 0.2)',\r\n                'rgba(255, 159, 64, 0.2)'\r\n            ],\r\n            borderColor: [\r\n\t\t\t\t'rgba(255, 159, 64, 1)',\r\n                'rgba(255,99,132,1)',\r\n                'rgba(54, 162, 235, 1)',\r\n                'rgba(255, 206, 86, 1)',\r\n                'rgba(75, 192, 192, 1)',\r\n                'rgba(153, 102, 255, 1)',\r\n                'rgba(255, 159, 64, 1)'\r\n            ],\r\n            borderWidth: 1,\r\n\t\t\tborderSkipped: top,\r\n        }]\r\n    },\r\n\t\r\n\t\r\n\r\n\t\r\n\t\r\n\t\r\n\t\r\n\t\r\n    options: {\r\n        scales: {\r\n            \t   xAxes: [{\r\n\t            \t\ttype: 'logarithmic',\r\n\t            \t\tposition: 'bottom',\r\n\t\t\t\t\t\t\r\n\t            \t\tticks: {\r\n\t\t\t\t\t\t\t\r\n\t            \t\t\tuserCallback: function(tick) {\r\n\t            \t\t\t\tvar remain = tick / (Math.pow(10, Math.floor(Chart.helpers.log10(tick))));\r\n\t            \t\t\t\tif (remain === 1) {\r\n\t\t\t\t\t\t\t\t\tvar test = tick.toString();\r\n\t\t\t\t\t\t\t\t\t\tif(test >= 1000 && test < 1000000){\r\n\t\t\t\t\t\t\t\t\t\t\treturn tick/1000 + \"kHz\";\r\n\t\t\t\t\t\t\t\t\t\t}else if(test >= 1000000 && test < 1000000000){\r\n\t\t\t\t\t\t\t\t\t\t\treturn tick/1000000 + \"MHz\";\r\n\t\t\t\t\t\t\t\t\t\t}else if(test >= 1000000000){\r\n\t\t\t\t\t\t\t\t\t\t\treturn tick/1000000000 + \"GHz\";\r\n\t\t\t\t\t\t\t\t\t\t}else {\r\n\t\t\t\t\t\t\t\t\t\t\treturn tick.toString() + \"Hz\";\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\r\n\t            \t\t\t\t\t\r\n\t            \t\t\t\t}\r\n\t            \t\t\t\treturn '';\r\n\t            \t\t\t},\r\n\t\t\t\t\t\t\tbeginAtZero: true,\r\n\t\t\t\t\t\t\t \r\n\t            \t\t},\r\n\t            \t\tscaleLabel: {\r\n\t            \t\t\tlabelString: 'Frequency',\r\n\t            \t\t\tdisplay: true,\r\n\t            \t\t}, \r\n\t\t\t\t\t\tstacked: true,\r\n\t\t\t\t\t\t\r\n\t            \t}],  yAxes: [{\r\n\t\t\t\t\t\tstacked: true,\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t}],\r\n\t            }\r\n    }\r\n});\r\n```\r\n\r\n\r\n\r\nThanks in advance!"},"comment":{"url":"https://api.github.com/repos/chartjs/Chart.js/issues/comments/230710264","html_url":"https://github.com/chartjs/Chart.js/issues/2914#issuecomment-230710264","issue_url":"https://api.github.com/repos/chartjs/Chart.js/issues/2914","id":230710264,"user":{"login":"aardidi","id":20298692,"avatar_url":"https://avatars.githubusercontent.com/u/20298692?v=3","gravatar_id":"","url":"https://api.github.com/users/aardidi","html_url":"https://github.com/aardidi","followers_url":"https://api.github.com/users/aardidi/followers","following_url":"https://api.github.com/users/aardidi/following{/other_user}","gists_url":"https://api.github.com/users/aardidi/gists{/gist_id}","starred_url":"https://api.github.com/users/aardidi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aardidi/subscriptions","organizations_url":"https://api.github.com/users/aardidi/orgs","repos_url":"https://api.github.com/users/aardidi/repos","events_url":"https://api.github.com/users/aardidi/events{/privacy}","received_events_url":"https://api.github.com/users/aardidi/received_events","type":"User","site_admin":false},"created_at":"2016-07-06T08:29:00Z","updated_at":"2016-07-06T08:29:00Z","body":"Closing this because there already is an **older thread** with the 0-logarithmic issue. If anyone wants a **workaround** for bar graphs, create a **hidden bar graph** at the end of your chart, it \"fixed\" it for me (there is an **8th** bar graph that's hidden in the picture):\r\n\r\n![new_01](https://cloud.githubusercontent.com/assets/20298692/16611863/462f2882-4364-11e6-93b7-97d76feef057.png)\r\n"}}
{"actor":{"display_login":"aardidi"}}