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

Line don't appear #209

Closed
KianoJ opened this issue Mar 16, 2020 · 3 comments
Closed

Line don't appear #209

KianoJ opened this issue Mar 16, 2020 · 3 comments

Comments

@KianoJ
Copy link

KianoJ commented Mar 16, 2020

Hi,
I already read other issue but without succes
I use ReactJs, I make the npm install and here is my code

let chart = new Chart(myChartRef, {
                type: "line",
                data: {
                    labels: date,
                    datasets: [{ label: measure, data: quality, borderColor: "blue", showLine: true, pointRadius: 10, pointHoverRadius: 15 }]
                },
                options: {
                    events: ['click'],
                    responsive: true,
                    scales: {
                        xAxes: [{
                            type: 'time',
                            distribution: 'series'
                        }]
                    },
                    tooltips: {
                        mode: "index",
                        intersect: true
                    },
                    plugins: {
                        annotation: {
                            annotations: [{
                                type: 'line',
                                mode: 'horizontal',
                                scaleID: 'y-axis-0',
                                value: 62,
                                borderColor: 'rgb(255, 192, 192)',
                                borderWidth: 4,
                            }]
                        }
                    }
                }
            });

And it's in the console

image

@cirmaciu
Copy link

Try to put your annotation settings right under options, Like this: https://codepen.io/jordanwillis/pen/qrXJLW
Somehow it doesn't work with options.plugins.annotation

@AlexanderRodecape
Copy link

I couldn't get any line to appear either, until I added the annotation element as a child of options.
options: {
annotation: {
annotations: [
{
type: 'line',
mode: 'vertical',
scaleID: 'x-axis-0',
value: payday.toString(),
borderColor: 'red',
borderWidth: 2,
}
]
}
}

@varunwilson6
Copy link

Mee too having the same,
<Line
width={200}
height={300}
data = {{
labels: labels,
datasets: [{
label: 'Voltage Fluctuation',
data: data,
borderWidth: 1
}]
}}
options={{
maintainAspectRatio: false,
legend: { display: false },
scales: {
xAxes: [{
type: 'time',
time: {
unit: 'minute',
displayFormats: {
hour: 'HH:mm:ss'
}
}
}]
},
annotation: {
annotations: [{
type: 'line',
mode: 'horizontal',
scaleID: 'y-axis-0',
value: 233,
borderColor: 'rgb(75, 192, 192)',
borderWidth: 4,
label: {
enabled: false,
content: 'Test label'
}
}]
}
}}
/>

@KianoJ KianoJ closed this as completed Aug 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants