#include "Pie.h" static void DrawPie(Draw& w, Point centre, int r, int start, int alpha, int width, class::Color fill, class::Color outline,uint64 pattern,class::Color background ) { const int dalpha=1; int n= alpha/dalpha; Vector vP; vP<(&w)) && !w.IsPrinter()) w.DrawRect(ix,iy,1,1,Blend(fill,background,150)); if(w.IsGui()) w.DrawRect(ix,iy,1,1,Blend(fill,background,150)); } vP<=0) { lastpos=pos+1; pos=content.Find(' ',lastpos); sz= GetTextSize(content.Left(pos+1), f); toDraw=sz.cx; } if (pos<0) { sz= GetTextSize(content, f); toDraw=sz.cx; if(toDraw=L) return; count++; content=content.Mid(lastpos); } } PieChart& PieChart::SetColor(const class::Color& _color) { backColor=_color; return *this; } PieChart& PieChart::SetTitle(const String& _title) { title=_title; return *this; } PieChart& PieChart::SetTitleFont(const Font& fontTitle) { titleFont=fontTitle; return *this; } PieChart& PieChart::SetTitleColor(const class::Color& colorTitle) { titleColor=colorTitle; return *this; } PieChart& PieChart::TitlePos(titlePosition pos) { titlePos=pos; return *this; } PieChart& PieChart::SetTitleGap(const int& gap) { titleGap=gap; return *this; } PieChart& PieChart::SetRadius(const int& r) { radius=r; return *this; } PieChart& PieChart::ShowPercent(bool show) { showPercent=show; return *this; } PieChart& PieChart::SetPercentBack(const class::Color& pbcolor) { percentBack=pbcolor; return *this; } PieChart& PieChart::SetLegendFont(const Font& fontLegend) { legendFont=fontLegend; return *this; } PieChart& PieChart::SetLegendTextColor(const class::Color& colorLegend) { legendTextColor=colorLegend; return *this; } PieChart& PieChart::SetLegendBackColor(const class::Color& colorBack) { legendBackColor=colorBack; return *this; } PieChart& PieChart::SetLegend_cx(const int& h) { legend_cx=h; return *this; } PieChart& PieChart::SetLegend_cy(const int& v) { legend_cy=v; return *this; } PieChart& PieChart::SetShowLegend(bool show) { showLegend=show; return *this; } void PieChart::AddCategory(const String& name, const double& value, const class::Color& catcolor) { vNames.Add(name); vValues.Add(value); vColors.Add(catcolor); Refresh(); } void PieChart::RemoveCategory(const int& index) { if(!vValues.IsEmpty() && vValues.GetCount()>index) { vNames.Remove(index); vValues.Remove(index); vColors.Remove(index); Refresh(); } } PieChart& PieChart::SetCatValue(const int& index, const double& value) { if(!vValues.IsEmpty() && vValues.GetCount()>index) { vValues[index]=value; Refresh(); } return *this; } PieChart& PieChart::SetCatName(const int& index, const String& name) { if(!vNames.IsEmpty() && vNames.GetCount()> index) { vNames[index]=name; Refresh(); } return *this; } PieChart& PieChart::SetCatColor(const int& index, const class::Color& catcolor) { if(!vColors.IsEmpty() && vColors.GetCount()> index) { vColors[index]=catcolor; Refresh(); } return *this; } double PieChart::GetCatValue(const int& index) const { if(!vValues.IsEmpty() && vValues.GetCount()>index) { return vValues[index]; } else return -1; } String PieChart::GetCatName(const int& index) const { if(!vNames.IsEmpty() && vNames.GetCount()> index) { return vNames[index]; } else return ""; } Acolor PieChart::GetCatColor(const int& index) const { if(!vColors.IsEmpty() && vColors.GetCount()> index) { return vColors[index]; } else return Null; } int PieChart::GetCatCount() const { return vColors.GetCount(); } void PieChart::PaintPie(Draw& w, int scale) { if(vValues.GetCount()>0) { double sum=0; int alfa0=-900; int a0=0; for(int i=0;i