score:10
you can use chart-options
to make your line straight
instead of curved
.
your canvas would look something like this:
<canvas class="chart chart-line" chart-data="lineData" chart-labels="lineLabels" chart-series="lineSeries" chart-options="lineOptions" chart-click="onClick"></canvas>
Add lineOptions
in your controller like this:
$scope.lineOptions ={ elements : { line : { tension : 0 } } };
//define other variables required for `line` as per your requirement.
//lineData , lineLabels , lineSeries, OnClick
This will make the tension of your line :0. Thus, your line will become straight.
If you still are not able to make your line straight using above methd, you can try installing the latest package(beta) by the below command:
bower install --save angular-chart.js#1.0.0
I hope this will solve your issue.
score:1
Try putting the same value for each index in the dataset. That will give you a straight line horizontally on a selected point along y-axis.
angular.module("app", ["chart.js"]).controller("LineCtrl", function ($scope) {
$scope.labels = ["January", "February", "March", "April", "May", "June", "July"];
$scope.series = ['Series A', 'Series B'];
$scope.data = [
[65, 65, 65, 65, 65, 65, 65],
[35, 35, 35, 35, 35, 35, 35]
];
$scope.onClick = function (points, evt) {
console.log(points, evt);
};
$scope.datasetOverride = [{ yAxisID: 'y-axis-1' }, { yAxisID: 'y-axis-2' }];
$scope.options = {
scales: {
yAxes: [
{
id: 'y-axis-1',
type: 'linear',
display: true,
position: 'left'
},
{
id: 'y-axis-2',
type: 'linear',
display: true,
position: 'right'
}
]
}
};
});
Here is markup
<canvas id="line" class="chart chart-line" chart-data="data"
chart-labels="labels" chart-series="series" chart-options="options"
chart-dataset-override="datasetOverride" chart-click="onClick"
</canvas>
Source: stackoverflow.com
Related Query
- Angular-chart.js - Make line chart does not curve
- Chart.js Chart in Angular does not load until resizing browser window
- Chartjs backgroundColor for line chart does not appear in Vue app
- angular 4 line chart data is not showing data from http get
- ChartJs does not render chart when binding canvas id in Angular
- Chart.js Line chart Option does not disable gridlines
- Chart.js line chart does not render data lines on iOS
- Trying to call API and plot a line chart but it does not show
- Chart.js - Line chart does not render all points when using Point[] format
- angular chart js type line setting chart-options not working
- Angular Chart color does not change
- show label in tooltip but not in x axis for chartjs line chart
- Html chart does not fit a small Android WebView
- Chart looks only grey, does not show the color - Chartjs,discordjs
- angular-chartjs line chart TypeError: t.merge is not a function
- Chart.js line chart is not displaying
- Line chart is not being displayed in Chart.js
- Series Details Not Showing in Angular Chart with Charts.js
- how to programmatically make a line chart point active/highlighted
- Time series line chart is not displayed
- Make months on x-axis clickable on chart.js line chart
- Time Series Line chart js in react not working
- How can I make line on chart thinner?
- Click event of stacked line chart not working
- My pie chart (chartJs) does not appear
- Chart.js chart does not display when inside an ngIf.
- Is it possible to make points in a line chart of Chart JS 3.7.0 look like a donut?
- Stacked line chart not displaying correctly when Xaxis is time
- Chart.js tooltip not showing on line chart
- annotation line not visible in scatter chart in chartjs
More Query from same tag
- ChartJS: how to change data in hover box?
- how to disable last/max value shown on x axis in chart js?
- Change tooltips title at chart.js?
- Diplay multiple chart js Diagrams on one page
- How to skip labels of a line in multiline graph in chartjs?
- How do I invert an y-axis using chart.js (v2.0-dev)
- How to can I get text inside a chats.js circular chart
- How put dataset labels into multiTooltipTemplate?
- How to set dynamic value for horizontal line in annotation plugin for Chart.js
- graph data from a angular form to ChartJs
- Custom scatter chart extended from scatter chart becomes line chart
- Chart.js vertical line when hovering and shadow on line
- Chartjs v2.8 showAllTooltips does not exist
- Angular and ChartJS to create bar chart
- Always Enable Tooltip : Chart JS : V3 : Bubble Chart : react-chartjs-2
- How to add a second set of labels to a Chart.js doughnut chart?
- Chart.js Point image on hover
- Can't get event from chartjs-annotation-plugin on mouseenter
- Adding space to begin of xAxis ticks in chartJS
- Split assoc array by keys
- moment.js is not loading before chart.js in Firefox extension
- ChartJS hover tooltip colors not showing their correct color
- break y axis in line chart chart.js
- Integrate chartjs-chart-treemap with react-chartjs-2
- Charts.js doughnut
- (ng2-charts, angular) Doughnut chart not showing up after AOT? (but filltext is working)
- Ng2 ChartData filled with observable
- Change time format in Chart.js date
- How do I make many ChartJS charts on the same page to have the same height and also even column width?
- Pass data to Chart Js Laravel