Return Type | Function name | Arguments |
---|---|---|
void | hdsChartBar::Generate | (hzChain&,hzHttpEvent*,unsigned int&,) |
Declared in file: hzDissemino.h
Defined in file : hdsGenerate.cpp
Function Logic:
Function body:
void hdsChartBar::Generate (hzChain& Z, hzHttpEvent* pE, unsigned int& nLine) { _hzfunc("hdsChartBar::Generate") ; hzList<_rset*>::Iter ri ; _rset* pSet ; double per_pixel_Y ; double stepSize ; uint32_t val ; 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); axisPixelsX = m_nSlotsX * m_nPxSlotX ; axisPixelsY = m_nSlotsY * m_nPxSlotY ; per_pixel_Y = (m_nMaxY - m_nMinY)/axisPixelsY ; 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) ; Y = 30; X = 20; 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 (n = 0; n <&eq; m_nSlotsX ; n++) { Y = m_origY ; X = m_origX + (n * m_nPxSlotX) + 1; for (ri = m_Sets ; ri.Valid() ; ri++) { pSet = ri.Element() ; val = ((pSet->m_vVals[n] - m_nMinY) * per_pixel_Y) ; Z.Printf("<rect x="%u" y="%u" width="%u" height="%u" style="fill:#%06x;"/>\n" , X, Y - val, (uint32_t)m_nPxSlotX - 1,val, pSet->color) ; Y -= val ; } } 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+15,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" ; }