score:0
It looks like a label has to be created for every x value. I may not know the x values at the time of the charts creation
I am not sure how your data arises, but aking into consideration the information provided, you should create an object containing all of your data points and use the object within the chart function.
To provide a solution for this part we would need more input about how your data is built.
I have huge numbers with many decimal places. I assume this will mean that most x values end up between labels.
Well, this is more or less the spirit of a line chart. Depending on the data's value you should just define your axes properly to get a understandable visualization of your data.
Is there a way to plot the points without having a circular plot point shape? Basically a smooth line running all the way from the left to the right that is created based on the x/y data?
Chart.JS comes with a lot of options to play with. E.g. you could use pointStyle
or pointRadius
properties to change the points to your needs.
I attached an example for you to adapt as needed. As you can see the lines are smoothly visualized. The example uses multiple chart types in one. You can just remove the bar part.
For further reference check out the official documentation, especially the line-chart part: https://www.chartjs.org/docs/latest/charts/line.html
var optionsMulti = {
chart: {
height: 280,
width: 375,
type: 'line',
stacked: false,
toolbar: {
show: false
},
plotOptions: {
bar: {
horizontal: false,
columnWidth: '55%',
endingShape: 'rounded'
},
},
},
series: [{
name: 'Goals scored',
data: [2, 4, 5, 1, 1, 3, 3, 2, 4, 5, 1, 3]
}, {
name: 'Goals Conceded',
data: [1, 1, 3, 4, 2, 2, 3, 2, 1, 2, 5, 3]
}, {
name: 'Points gained',
type: 'column',
data: [3, 3, 3, 0, 0, 3, 0, 0, 3, 3, 0, 1]
}],
stroke: {
width: [4, 4, 4],
curve: 'smooth'
},
labels: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
xaxis: {
type: 'category',
line: {
show: false
},
},
yaxis: {
min: 0,
max: 6,
tickamount: 6,
labels: {
show: false
},
line: {
show: false
},
},
};
var chartMulti = new ApexCharts(
document.querySelector("#chartMulti"),
optionsMulti
);
chartMulti.render();
<html>
<body>
<div id="chartMulti"></div>
</body>
<script src="https://cdn.jsdelivr.net/npm/apexcharts"></script>
</html>
Source: stackoverflow.com
Related Query
- chartJS line chart not plotting values that are less than minY
- ChartJS plotting x/y in a line chart
- Display line chart with connected dots using chartJS
- Chartjs 2 - Stacked bar and unstacked line on same chart with same y axis
- show label in tooltip but not in x axis for chartjs line chart
- chartjs show dot point on hover over line chart
- ChartJs line chart repaint glitch while hovering over
- ChartJS - Line Chart with different size datasets
- Show data dynamically in line chart - ChartJS
- Line chart is showing under bar in combochart in chartjs
- ChartJS - Line chart issue with only 1 point
- ChartJs line chart - display permanent icon above some data points with text on hover
- Map event position to y axis value in chartjs line chart
- How to draw Horizontal line on Bar Chart Chartjs
- ChartJS Line chart cut off at the top and bottom
- How to dynamically set ChartJs line chart width based on dataset size?
- ChartJS - handling of overlapping points in line chart
- ChartJS line chart drag and zoom
- ChartJS - how to display line chart with single element as a line? (not as a dot)
- ChartJS (React) Line Chart - How to show single tooltip with data and labels from 3 (multiple) dataset?
- chartjs - multi axis line chart - cannot read property 'min' of undefined
- Chart.js plotting two json datasets on a line chart
- Gradient line chart with ChartJS
- annotation line not visible in scatter chart in chartjs
- Adding line over stacked line chart with ChartJS
- Empty circle - only point strok in line chart for ChartJS
- Do not draw line on condition in ChartJS line chart
- Remove background color in chartjs line chart
- how to highlight a specific area on chartjs line chart
- chartjs show 24 hours in line chart
More Query from same tag
- How do I update the Chart.js automatically every 2 seconds?
- Chart.js -- using update() with time scale datasets
- How to create a pannable real-time chart
- findOne returns undefined in onRendered
- Chartkick cumulative chart by date never descending
- PrimeNG/Chart.js - max Number of labels to show
- What's the most effective way to implement a radar plot with 50 points at arbitrary locations using chart.js
- Want only line not area under it in chart js
- Beginner in JS,Stuck with ChartJS and multiple filters and ways to display
- Use Chartjs with reactjs
- Get string[] in razor view javascript from mvc controller
- How to use two datasets in chart.js doughnut chart?
- How could chartjs font family display everywhere
- The expected type comes from property 'XAxes' and 'yAxes' which is declared here on type '_DeepPartialObject<{ [key: string]:
- How to add an image to a slice of a donut chart in chart.js?
- Make Line Chart Dynamic From JSON File Using Chartjs
- How do I make the Line in ChartJS not exceed the maximum of yAxes
- Display data at ends of floating bar graph (created using chart js)
- ChartJs: Loading fresh data to Chart
- Chart.js canvas rendered by ng-repeat does not show charts
- Data is not display in correct order after update
- JSX element type 'Line' is not a constructor function for JSX elements
- Want to show the dataset labels
- Why prettier put a comma ',' at the last element of the object
- Chart.js overlapping tooltip text
- How to hide grid lines and x-axis labels in chart.js?
- How put dataset labels into multiTooltipTemplate?
- Chart.js bar chart barWidth is Inconsistent
- Chart.js - generateLegend() call results in "undefined is not a function"
- How to convert UNIX timestamp to date using chart.js?