Replies: 1 comment
-
You can just add a second x axis for labels for your other dataset, also your title for both axis works fine: https://jsfiddle.net/Leelenaleee/g34c5jrq/4/ |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi there I have two question:
First, how can I set two labels, one for line and another one for a scatter, as you see, I have a combined graph (line and scatter), how can i set two labels?
Second: I don't know why, but when i put titles in x and y axis I get an error like this:
Line 318 ia this:
var myChart9 = new Chart(ctx9, {
The funny it is that when i put title in just one axis, i don't get an error, and when I try putting in others graph they works, so I don't know what is wrong.
Browser: Firefox Browser version 89.0.2 (64-bit)
Script in html:
<script src="https://code.jquery.com/jquery-3.3.1.js"></script> <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
Here is the code .js:
var myChart9 = new Chart(ctx9, { type: 'line', data: { labels: tempTable, datasets: [{ label: 'Humedad Absoluta', type: "line", borderColor: "#3e95cd", data:humAbsoTable, fill: false, cubicInterpolationMode: 'monotone', tension: 0.4, },{ label: 'Actual', data: [,,0.023], backgroundColor: 'rgba(255, 99, 132, 0.3)', borderColor: 'rgba(255, 99, 132, 1)', borderWidth: 1, type:"scatter", radius: 7 }] }, options: { scales: { x:{ ticks:{ maxTicksLimit:15 } }, y: { beginAtZero: true, ticks:{ maxTicksLimit:15 }, display: true, title: { display: true, text: 'Humedad Absoluta (KgVap/KgAS)', font: { family: 'Helvetica Neue', size: 13, style: 'normal', lineHeight: 1.2 }, } } }, plugins: { legend:false, title: { display: true, text: 'Huemdad y Temperatura', font: { family: 'Helvetica Neue', size: 15, weight:'lighter', lineHeight: 1.2 } }, tooltip: { enabled:false, callbacks: { label: (item) => item.dataset.label + ': ' + formatter.format(item.parsed.y), } } } } });
Beta Was this translation helpful? Give feedback.
All reactions