mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
ScatterDraw: Improvements proposed by wqcmaster
git-svn-id: svn://ultimatepp.org/upp/trunk@10613 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
ec6e577278
commit
2e743e9c10
4 changed files with 33 additions and 11 deletions
|
|
@ -78,9 +78,9 @@ Color PieDraw::GetCatColor(const int& index) const {
|
|||
}
|
||||
|
||||
void PieDraw::PaintPie(Draw& w, int scale) {
|
||||
Size sz = GetSize();
|
||||
Size sz = scale*GetSize();
|
||||
|
||||
w.DrawRect(scale*sz, backColor);
|
||||
w.DrawRect(sz, backColor);
|
||||
|
||||
Size textsize;
|
||||
textsize.cx = 0;
|
||||
|
|
@ -101,7 +101,7 @@ void PieDraw::PaintPie(Draw& w, int scale) {
|
|||
if(vValues.IsEmpty())
|
||||
return;
|
||||
|
||||
int alfa0 = -900;
|
||||
int alfa0 = -900 + (int)pieAngle;
|
||||
int a0 = 0;
|
||||
double sum = 0;
|
||||
for(int i = 0; i < vValues.GetCount(); i++)
|
||||
|
|
@ -142,7 +142,7 @@ void PieDraw::PaintPie(Draw& w, int scale) {
|
|||
alfa0 += fround(3600.0*vValues[i]/sum);
|
||||
}
|
||||
if(showPercent) {
|
||||
alfa0 = -900;
|
||||
alfa0 = -900 + (int)pieAngle;
|
||||
for(int i = 0; i < vValues.GetCount(); i++) {
|
||||
a0 = alfa0;
|
||||
alfa0 += fround(3600.0*vValues[i]/sum);
|
||||
|
|
@ -188,9 +188,9 @@ String PieDraw::GetPercent(double a, double total) {
|
|||
return FormatDouble(p, 1) + '%';
|
||||
}
|
||||
|
||||
Drawing PieDraw::GetDrawing() {
|
||||
DrawingDraw ddw(3*GetSize());
|
||||
PaintPie(ddw, 3);
|
||||
Drawing PieDraw::GetDrawing(int scale) {
|
||||
DrawingDraw ddw(scale*GetSize());
|
||||
PaintPie(ddw, scale);
|
||||
return ddw;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ public:
|
|||
Color GetCatColor (const int& index)const;
|
||||
int GetCatCount() const {return vColors.GetCount();}
|
||||
|
||||
Drawing GetDrawing();
|
||||
Drawing GetDrawing(int scale = 3);
|
||||
Image GetImage(int scale = 1);
|
||||
|
||||
virtual void Refresh() {};
|
||||
|
|
|
|||
|
|
@ -386,6 +386,7 @@ void ScatterDraw::ZoomToFit(bool horizontal, bool vertical, double factor) {
|
|||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
double ScatterDraw::GetXMin() {
|
||||
double minx = -DOUBLE_NULL;
|
||||
|
|
@ -792,6 +793,14 @@ double ScatterDraw::GetValueY(int index, int64 idata) {
|
|||
}
|
||||
}
|
||||
|
||||
ScatterDraw &ScatterDraw::SetNoPlot(int index) {
|
||||
ASSERT(IsValid(index));
|
||||
|
||||
series[index].seriesPlot = NULL;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
ScatterDraw &ScatterDraw::PlotStyle(SeriesPlot *data) {
|
||||
int index = series.GetCount() - 1;
|
||||
|
||||
|
|
@ -1003,6 +1012,18 @@ Color ScatterDraw::GetFillColor(int index) const {
|
|||
return series[index].fillColor;
|
||||
}
|
||||
|
||||
ScatterDraw &ScatterDraw::SetMarkBorderWidth(int index, double width) {
|
||||
ASSERT(IsValid(index));
|
||||
series[index].markBorderWidth = width;
|
||||
Refresh();
|
||||
return *this;
|
||||
}
|
||||
|
||||
double ScatterDraw::GetMarkBorderWidth(int index) {
|
||||
ASSERT(IsValid(index));
|
||||
return series[index].markBorderWidth;
|
||||
}
|
||||
|
||||
ScatterDraw &ScatterDraw::SetMarkWidth(int index, double markWidth) {
|
||||
ASSERT(IsValid(index));
|
||||
series[index].markWidth = markWidth;
|
||||
|
|
@ -1134,8 +1155,7 @@ void ScatterDraw::RemoveAllSeries() {
|
|||
Refresh();
|
||||
}
|
||||
|
||||
Drawing ScatterDraw::GetDrawing(const Size _size) {
|
||||
int scale = 3;
|
||||
Drawing ScatterDraw::GetDrawing(const Size _size, int scale) {
|
||||
Size size = IsNull(_size) ? GetSize() : _size;
|
||||
DrawingDraw ddw(scale*size);
|
||||
|
||||
|
|
|
|||
|
|
@ -327,6 +327,8 @@ public:
|
|||
double GetValueX(int index, int64 idata);
|
||||
double GetValueY(int index, int64 idata);
|
||||
|
||||
ScatterDraw &SetNoPlot(int index);
|
||||
|
||||
ScatterDraw &PlotStyle() {return PlotStyle(0);};
|
||||
template <class C>
|
||||
ScatterDraw &PlotStyle() {return PlotStyle(new C());};
|
||||
|
|
@ -425,7 +427,7 @@ public:
|
|||
ScatterDraw& Id(int index, int id);
|
||||
int GetId(int index);
|
||||
|
||||
Drawing GetDrawing(const Size size = Null);
|
||||
Drawing GetDrawing(const Size size = Null, int scale = 3);
|
||||
Image GetImage(int scale = 2);
|
||||
Image GetImage(const Size &size, int scale = 2);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue