FVANCOP / ChartNew.js

MIT License
420 stars 143 forks source link

1-D Scatter Plot #524

Closed tasoskakour closed 6 years ago

tasoskakour commented 6 years ago

Hello! I want to plot a simple 1d scatter plot (like this https://i.stack.imgur.com/3bN1w.png).

So basically I just want to plot points, not lines.

Is it possible to do this?

Also how to position the x axis in middle of the graph like in the picture?

Thanks in advance, keep up the awesome work!

markosko commented 6 years ago

maybe you can use line type but with line color transparent and with only point color and similar, about scale option you can use scaleOverride check in wiki for example

FVANCOP commented 6 years ago

Try this :

 var mydata1 = {
labels : [-1,0,1,2,3,4,5,6,7],
datasets : [
    {
        pointColor : "black",
        strokeColor : "rgba(0,0,0,0)",
        pointStrokeColor : "black",
        markerShape : "cross",
        data : [    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0],
        xPos : [-0.50,-0.30,-0.22,-0.07, 0.33, 1.22, 2.47, 3.28, 4.12, 4.96, 5.31, 5.66],
        title : "points"

    }
]
 };           
 var opt1 = {
  datasetFill : false,
  graphTitle : "Point Plot",
  graphTitleFontSize: 18,
  yAxisMinimumInterval : 0.1,
  graphMin : -0.5,
  graphMax :  0.499,
 } ;

canvas

tasoskakour commented 6 years ago

Thanks a lot guys!