Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Barchart label numbers are falling of the chart #28

Closed
Sireini opened this issue Feb 5, 2018 · 2 comments
Closed

Barchart label numbers are falling of the chart #28

Sireini opened this issue Feb 5, 2018 · 2 comments

Comments

@Sireini
Copy link

Sireini commented Feb 5, 2018

What is seems to do is that it is not picking up the options correctly, the barchart labels are falling off the chart. Here is what my barchart component looks like

<script>
import VueChartjs from 'vue-chartjs'
export default {
	extends: VueChartjs.Bar,
	props: ['data', 'barWidth'],
	data() {
		return {
			options: {
				plugins: {
					datalabels: {
						color: "white",
						display: function(context) {
							return context.dataset.data[context.dataIndex] > 0;
						},
						font: {
							weight: 'bold',
							size: '14'
						},
						formatter: Math.round
					}
				},
				responsive: false,
				maintainAspectRatio: false,
				tooltips: false,
				legend: {
					display: false
				},
				scaleShowVerticalLines: false,
				scales: {
					yAxes: [{
						display: false,

						ticks: {
							display: false
						}
					}],
					xAxes: [{
						barPercentage: this.barWidth
					}]
				}
			}
		}
	},
	mounted() {
		this.renderChart(this.data, this.options)
	}
}
</script>

If I log this.options it returns me everything, recently I had the same issue deleting the node_modules and yarn install solved it but not it seems not to work..

Here you see an result of what i describe above:

https://user-images.githubusercontent.com/12531305/35614529-b2c2452c-066f-11e8-820d-95dd006effab.png

Environment
vue.js version: ^2.5.2
vue-chart.js version: ^3.0.0
npm version: 5.6.0
chartjs-plugin-datalabels": "^0.1.0",

@simonbrunel
Copy link
Member

Isn't it the same issue as #15? Can you post a fiddle?

@simonbrunel
Copy link
Member

It looks like the same as #15. If not, feel free to reopen with a jsfiddle that reproduces your issue.

Closing as duplicate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants