| Return Type | Function name | Arguments |
|---|---|---|
| void | hdsChartStd::Generate | (hzChain&,hzHttpEvent*,unsigned int&,) |
Declared in file: hzDissemino.h
Defined in file : hdsGenerate.cpp
Function Logic:
Function body:
void hdsChartStd::Generate (hzChain& Z, hzHttpEvent* pE, unsigned int& nLine)
{
_hzfunc("hdsChartStd::Generate") ;
hzList<_rset*>::Iter ri ;
_rset* pSet ;
double per_pixel_X ;
double per_pixel_Y ;
double val ;
double stepSize ;
uint32_t X ;
uint32_t Y ;
uint16_t axisPixelsX ;
uint16_t axisPixelsY ;
uint32_t n ;
/*
** ** Start draw instrutions
** */
Z.Printf("<svg id="%s" height="%d" width="%d" style="border:1px solid #000000; background:#%06x;">" , *m_Id, m_Height, m_Width, m_BgColor) ;
if (m_Header)
_hds_svg_drawText(Z, m_Header, m_Width/2,20,m_FgColor,1);
axisPixelsY = m_nSlotsY * m_nPxSlotY ;
axisPixelsX = m_nSlotsX * m_nPxSlotX ;
per_pixel_Y = (m_nMaxY - m_nMinY)/axisPixelsY ;
per_pixel_X = (m_nMaxX - m_nMinX)/axisPixelsX ;
Z.Printf("<line x1="%u" y1="%u" x2="%u" y2="%u" style="stroke:#%06x;stroke-width:1"/>\n" , m_origX, m_origY - axisPixelsY, m_origX, m_origY, m_FgColor) ;
Z.Printf("<line x1="%u" y1="%u" x2="%u" y2="%u" style="stroke:#%06x;stroke-width:1"/>\n" , m_origX, m_origY, m_origX + axisPixelsX, m_origY, m_FgColor) ;
X = 20;
Y = 30;
Z.Printf("<text x="%u" y="%u" fill="#%06x">%s</text>\n" , X, Y, m_FgColor, *m_HdrY) ;
stepSize = (m_nMaxY - m_nMinY)/m_nSlotsY ;
Y = m_origY ;
for (val = m_nMinY ; val <&eq; m_nMaxY ; val += stepSize)
{
Z.Printf("<text x="%u" y="%u" fill="#%06x">%u</text>\n" , X, Y, m_FgColor, (uint32_t) val) ;
Y -= m_nPxSlotY ;
}
stepSize = (m_nMaxX - m_nMinX)/m_nSlotsX ;
Y = m_origY + 20;
X = m_origX ;
for (val = m_nMinX ; val <&eq; m_nMaxX ; val += stepSize)
{
Z.Printf("<text x="%u" y="%u" fill="#%06x">%u</text>\n" , X, Y, m_FgColor, (uint32_t) val) ;
X += m_nPxSlotX ;
}
for (ri = m_Sets ; ri.Valid() ; ri++)
{
pSet = ri.Element() ;
Z << "<polyline points="" ;
X = m_origX + ((m_hVals[0]- m_nMinX)/per_pixel_X) ;
Y = m_origY - ((pSet->m_vVals[0]- m_nMinY)/per_pixel_Y) ;
Z.Printf("%u,%u", X, Y) ;
for (n = 1; n <&eq; m_nSlotsX ; n++)
{
X = m_origX + ((m_hVals[n] - m_nMinX)/per_pixel_X) ;
Y = m_origY - ((pSet->m_vVals[n] - m_nMinY)/per_pixel_Y) ;
Z.Printf(" %u,%u", X, Y) ;
}
Z.Printf("" style="fill:none;stroke:#%06x;stroke-width:1"/>\n" , pSet->color) ;
}
Y = m_origY + 40;
if (m_Sets.Count() > 1)
{
X = m_origX ;
for (ri = m_Sets ; ri.Valid() ; ri++)
{
pSet = ri.Element() ;
Z.Printf("<rect x="%u" y="%u" width="%u" height="%u" style="fill:#%06x;"/>\n" , X, Y, 12,12,pSet->color);
Z.Printf("<text x="%u" y="%u" fill="#%06x">%s</text>\n" , X+15,Y+12,m_FgColor,*pSet->header);
X += 10*(pSet->header.Length()) ;
}
Y += 20;
}
if (m_Footer)
_hds_svg_drawText(Z, m_Footer, m_Width/2,Y, m_FgColor, 1);
Z
<< "Your Browser does not support the HTML5 SVG tag\n</svg>\n"
;
}