Jump to content

Recommended Posts

Posted

Criei um gráfico de barra, mas quando clico na legenda a coluna some mas os valores não.

 

function ChartQuantMes() {

	StatusMesGT.length = 0;
	StatusMesG.length = 0;
	CarregarQuantMes();

	var chttT = document.getElementById("myChartQuantMes");
	var ctx100 = chttT.getContext("2d");

	window.myChartQuantMes = new Chart(ctx100, {
		type: 'bar',
		data: {
			labels: ['JAN', 'FEV', 'MAR', 'ABR', 'MAI', 'JUN', 'JUL', 'AGO', 'SET', 'OUT', 'NOV', 'DEZ'],
			datasets: [
				{
					label: 'Etiqueta',
					data: StatusMesG,
					backgroundColor: '#1E90FF',

				},
				{
					label: 'Cartão',
					data: StatusMesGT,
					backgroundColor: '#ADD8E6',

				}],
		},

		options: {

			plugins: {
				datalabels: {
					anchor: function (context) {
						var value = context.dataset.data[context.dataIndex];
						return value > 1 ? 'end' : 'end';
					},
					align: function (context) {
						if (context.dataset.label == "Etiqueta") {
							var value = context.dataset.data[context.dataIndex];
							return value > 1 ? 'end' : 'end';
						} else {
							var value = context.dataset.data[context.dataIndex];
							return value > 1 ? 'end' : 'end';
						}
					},
					color: function (context) {
						var value = context.dataset.data[context.dataIndex];
						return value.v < 50 ? context.dataset.backgroundColor : 'black';
					},
					font: function (context) {
						var width = context.dataset.data;
						return { size: 18 };
					},

				},
			},
			responsive: true,
			title: {
				display: true,
				text: "Quantidade Mensal de Etiquetas / Cartão - Depto " + $('#Depto').val(),
				lineHeight: '5',
				fontSize: 20,
			},

			responsive: true,

			legend: {
				display: true,
				position: 'bottom'
			},

			scaleShowHorizintalLines: false,

			scales: {
				xAxes: [{
					stacked: false,

					display: true,
				}],

				yAxes: [{
					stacked: false,
					ticks: {
						beginAtZero: false,
						bounds: false,
						display: false,
						mirror: true,
						max: MatrizC1 + 10,
					},

					gridLines: {
						display: false,
					},

				}]
			},

		}

	});

}
Posted

Tens de ler a documentação da bilbioteca que estás a usar.

10 REM Generation 48K!
20 INPUT "URL:", A$
30 IF A$(1 TO 4) = "HTTP" THEN PRINT "400 Bad Request": GOTO 50
40 PRINT "404 Not Found"
50 PRINT "./M6 @ Portugal a Programar."

 

Posted

Já verificaste se é um bug e se a biblioteca tem uma versão mais recente com essa questão resolvida?

10 REM Generation 48K!
20 INPUT "URL:", A$
30 IF A$(1 TO 4) = "HTTP" THEN PRINT "400 Bad Request": GOTO 50
40 PRINT "404 Not Found"
50 PRINT "./M6 @ Portugal a Programar."

 

Posted
Em 12/09/2018 às 11:04, M6 disse:

Já verificaste se é um bug e se a biblioteca tem uma versão mais recente com essa questão resolvida?

Eu utilizo estas bibliotecas para a configuração dos indicadores:

<script type="text/javascript" src="../SiteAssets/js/Form/Chart.js"></script>

<script type="text/javascript" src="../SiteAssets/js/Form/Chart.min.js">

<script type="text/javascript" src="../SiteAssets/js/Library/chartjs-plugin-datalabels.js"></script>

<script type="text/javascript" src="../SiteAssets/js/Library/chartjs-plugin-datalabels.min.js"></script>

 

Você conhece alguma delas?

Posted

Assim pelo nome dos ficheiros não.

10 REM Generation 48K!
20 INPUT "URL:", A$
30 IF A$(1 TO 4) = "HTTP" THEN PRINT "400 Bad Request": GOTO 50
40 PRINT "404 Not Found"
50 PRINT "./M6 @ Portugal a Programar."

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.