Next: , Previous: , Up: 1D samples   [Contents][Index]


3.5.13 Candle sample

Function candle draw candlestick chart. This is a combination of a line-chart and a bar-chart, in that each bar represents the range of price movement over a given time interval. The sample code is:

int sample(mglGraph *gr)
{
  mglData y(30);  gr->Fill(y,"sin(pi*x/2)^2");
  mglData y1(30); gr->Fill(y1,"v/2",y);
  mglData y2(30); gr->Fill(y2,"(1+v)/2",y);
  gr->SubPlot(1,1,0,"");  gr->Title("Candle plot (default)");
  gr->SetRange('y',0,1);  gr->Box();  gr->Candle(y,y1,y2);
  return 0;
}
Example of Candle()