@@ -5,43 +5,48 @@ import {
55 setAutoHeight
66} from "@formsort/custom-question-api" ;
77
8+ // Need a function that can transform: current weight, weight loss time horizon into a data object
89const allAnswers = getAnswerValue ( ) ;
910
1011( async function ( ) {
1112 const data = [
1213 { month : "Jan" , weight : 250 } ,
1314 { month : "Feb" , weight : 250 } ,
14- { month : "Mar" , weight : 200 } ,
15- { month : "Apr" , weight : 150 } ,
16- { month : "May" , weight : 50 } ,
17- { month : "Jun" , weight : 0 }
15+ { month : "Jun" , weight : 200 }
1816 ] ;
1917
2018 new Chart ( document . getElementById ( "data" ) , {
2119 type : "line" ,
2220 options : {
2321 pointStyle : false ,
24- pointRadius : 5 ,
2522 fill : true ,
26- backgroundColor : "rgb(254,250,224 ,0.8)" ,
27- borderColor : "rgb(188,108,37,0.8 ) " ,
23+ backgroundColor : "rgb(229,229,229 ,0.8)" ,
24+ borderColor : "#00000 " ,
2825 borderWidth : 3 ,
29- legend : { display : false } ,
3026 scales : {
3127 x : {
28+ type : "category" ,
29+ max : 2 ,
30+ labels : [ "January" , "February" , "March" , "April" , "May" ] ,
31+ // min: "February",
3232 grid : {
3333 display : false
3434 }
3535 } ,
3636 y : {
37+ type : "linear" ,
38+ // beginAtZero: true,
3739 grid : {
3840 display : false
41+ } ,
42+ ticks : {
43+ count : 2
3944 }
4045 }
4146 }
4247 } ,
48+ plugins : { } ,
4349 data : {
44- labels : data . map ( ( row ) => row . month ) ,
4550 datasets : [
4651 {
4752 label : "Weight loss prediction" ,
0 commit comments