diff --git a/demos/modules/graph/main.c b/demos/modules/graph/main.c index 04d0b9b8..544d4c2b 100644 --- a/demos/modules/graph/main.c +++ b/demos/modules/graph/main.c @@ -3,12 +3,12 @@ #include "gfx.h" #include "math.h" -int data[5][2] = { - { 0, 0 }, - { 10, 10 }, - { 20, 20 }, - { 30, 30 }, - { 40, 40 } +const GGraphPoint data[5] = { + { -40, -40 }, + { 70, 40 }, + { 140, 60 }, + { 210, 60 }, + { 280, 200 } }; GGraphObject g; @@ -24,8 +24,8 @@ GGraphStyle GraphStyle1 = { }; GGraphStyle GraphStyle2 = { - { GGRAPH_POINT_DOT, 0, Green }, // point - { GGRAPH_LINE_NONE, 2, Gray }, // line + { GGRAPH_POINT_SQUARE, 5, Red }, // point + { GGRAPH_LINE_DOT, 2, Pink }, // line { GGRAPH_LINE_SOLID, 0, White }, // x axis { GGRAPH_LINE_SOLID, 0, White }, // y axis { GGRAPH_LINE_DASH, 5, Gray, 50 }, // x grid @@ -53,11 +53,17 @@ int main(void) { gwinGraphDrawPoint(gh, i-gwinGetWidth(gh)/2, 80*sin(2*0.2*M_PI*i/180)); gwinGraphStartSet(gh); - gwinGraphSetStyle(gh, &GraphStyle2); + GraphStyle1.point.color = Green; + gwinGraphSetStyle(gh, &GraphStyle1); for(i = 0; i < gwinGetWidth(gh)*5; i++) gwinGraphDrawPoint(gh, i/5-gwinGetWidth(gh)/2, 95*sin(2*0.2*M_PI*i/180)); + gwinGraphStartSet(gh); + gwinGraphSetStyle(gh, &GraphStyle2); + + gwinGraphDrawPoints(gh, data, sizeof(data)/sizeof(data[0])); + while(TRUE) { chThdSleepMilliseconds(100); } diff --git a/demos/modules/graph/result-640x480.gif b/demos/modules/graph/result-640x480.gif index 5d5152f5..d96c7c5a 100644 Binary files a/demos/modules/graph/result-640x480.gif and b/demos/modules/graph/result-640x480.gif differ