plot graph from (0,0)

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • plot graph from (0,0)

      I had created graph as below code shown and able to update graph but graph update is always from right to left. I want from (0, 0) please share some piece of code




      hGraph = GRAPH_CreateEx ( 0, 0, LCD_X_SIZE-200, LCD_Y_SIZE-75, 0, WM_CF_SHOW, 0, GUI_ID_GRAPH0 );
      GRAPH_SetBorder ( hGraph, 50, 0, 0, 50 );
      GRAPH_SetGridVis ( hGraph, 1 );
      GRAPH_SetColor ( hGraph, GUI_LIGHTGRAY, GRAPH_CI_GRID );
      GRAPH_SetColor ( hGraph, GUI_WHITE, GRAPH_CI_BK );
      GRAPH_SetColor ( hGraph, GUI_LIGHTGRAY, GRAPH_CI_BORDER );

      /* Create a curve for graph */
      hData = GRAPH_DATA_YT_Create (GUI_RED, 700, 0, 20);
      // hData = GRAPH_DATA_XY_Create (GUI_RED, 700, 0, 20);
      // GRAPH_DATA_XY_SetLineStyle (hData, GUI_LS_SOLID);
      GRAPH_DATA_XY_SetPenSize( hData, 10 );
      /* Attach curve to graph */
      GRAPH_AttachData (hGraph, hData);


      /* Create and add vertical scale */
      hScale = GRAPH_SCALE_Create ( 45, GUI_TA_RIGHT, GRAPH_SCALE_CF_VERTICAL, 50 );
      GRAPH_SCALE_SetOff ( hScale, 0 );
      GRAPH_SCALE_SetFactor ( hScale, MachineCapacity/(400) );
      GRAPH_SCALE_SetTextColor ( hScale, GUI_GRAY );
      GRAPH_AttachScale ( hGraph, hScale );

      /* Create and add horizontal scale */
      hScale = GRAPH_SCALE_Create ( LCD_Y_SIZE-35, GUI_TA_HORIZONTAL, GRAPH_SCALE_CF_HORIZONTAL, 50 );
      GRAPH_SCALE_SetOff ( hScale, -3 );
      GRAPH_SCALE_SetFactor ( hScale, 0.02f );
      GRAPH_SCALE_SetTextColor ( hScale, GUI_GRAY );
      GRAPH_AttachScale ( hGraph, hScale );

      WIDGET_SetEffect ( hGraph, &WIDGET_Effect_Simple );
      GRAPH_SetUserDraw ( hGraph, _UserDraw );

      while (1){

      if (secFlag==SET){
      GRAPH_DATA_YT_AddValue (hData, fValue);
      secFlag = RESET;
      }
      GUI_Delay (100);

      }
    • Hi,

      Try

      C Source Code

      1. GRAPH_DATA_YT_SetAlign(hData, GRAPH_ALIGN_LEFT);
      Regards,
      Sven
      Please read the forum rules before posting.

      Keep in mind, this is *not* a support forum.
      Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
      Should you be entitled to support you can contact us via our support system: segger.com/ticket/

      Or you can contact us via e-mail.