Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -182,3 +182,7 @@ UpgradeLog*.htm
# Microsoft Fakes
FakesAssemblies/
/.vs

# JetBrains Idea

.idea
53 changes: 31 additions & 22 deletions Chart.Scatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,7 @@
this.strokeColor = datasetOptions.strokeColor || chartOptions.datasetStrokeColor;
this.pointColor = datasetOptions.pointColor || datasetOptions.strokeColor || chartOptions.datasetStrokeColor;
this.pointStrokeColor = datasetOptions.pointStrokeColor || chartOptions.datasetPointStrokeColor;
this.strokeWidth = datasetOptions.strokeWidth || chartOptions.datasetStrokeWidth;

this.pointDot = chartOptions.pointDot;
this.pointDotRadius = chartOptions.pointDotRadius;
Expand Down Expand Up @@ -1023,40 +1024,48 @@
var ctx = this.chart.ctx,
prev = undefined;

ctx.lineJoin = "round";
ctx.lineWidth = this.options.datasetStrokeWidth;
ctx.strokeStyle = dataset.strokeColor || this.options.datasetStrokeColor;

ctx.beginPath();

helpers.each(dataset.points, function (point, index) {
if (dataset.strokeWidth==0) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please invert this if to avoid multiple return points of the funciton

return;
}
else {
ctx.lineJoin = "round";
ctx.lineWidth = dataset.strokeWidth || this.options.datasetStrokeWidth;
ctx.strokeStyle = dataset.strokeColor || this.options.datasetStrokeColor;

if (index === 0) {
ctx.beginPath();

ctx.moveTo(point.x, point.y);
}
else {
helpers.each(dataset.points, function (point, index) {

if (this.options.bezierCurve) {
if (index === 0) {

ctx.bezierCurveTo(
prev.controlPoints.x2,
prev.controlPoints.y2,
point.controlPoints.x1,
point.controlPoints.y1,
point.x, point.y);
ctx.moveTo(point.x, point.y);
}
else {

ctx.lineTo(point.x, point.y);
if (this.options.bezierCurve) {

ctx.bezierCurveTo(
prev.controlPoints.x2,
prev.controlPoints.y2,
point.controlPoints.x1,
point.controlPoints.y1,
point.x, point.y);
}
else {

ctx.lineTo(point.x, point.y);
}
}
}

prev = point;
prev = point;

}, this);
}, this);

ctx.stroke();

}

ctx.stroke();

// debug
//if (this.options.bezierCurve) {
Expand Down
6 changes: 3 additions & 3 deletions Chart.Scatter.min.js

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions Chart.Scatter.min.map

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,26 @@

[Documentation & live demo](http://dima117.github.io/Chart.Scatter/)


## Changes in this fork

This fork has option to set line (stroke) width as zero to disable them per dataset.
E.g.

```javascript
var datasets = [
{
label: "dataset 1",
strokeWidth: 5,
data: data
},
{
label: "dataset 2",
strokeWidth: 0, // here we have zero width and only points are drawn
data: data2 }
];
```

## License

Chart.Scatter.js is available under the [MIT license](http://opensource.org/licenses/MIT).
Expand Down
2 changes: 1 addition & 1 deletion test.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!DOCTYPE html>

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
Expand Down