Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
magicseteditor
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
magicseteditor
Commits
c352ed65
Commit
c352ed65
authored
May 31, 2008
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some tweaks of pie graphs
parent
03db640f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
12 deletions
+15
-12
src/gui/control/graph.cpp
src/gui/control/graph.cpp
+15
-12
No files found.
src/gui/control/graph.cpp
View file @
c352ed65
...
@@ -382,26 +382,29 @@ void PieGraph::draw(RotatedDC& dc, int current, DrawLayer layer) const {
...
@@ -382,26 +382,29 @@ void PieGraph::draw(RotatedDC& dc, int current, DrawLayer layer) const {
Color
fg
=
wxSystemSettings
::
GetColour
(
wxSYS_COLOUR_WINDOWTEXT
);
Color
fg
=
wxSystemSettings
::
GetColour
(
wxSYS_COLOUR_WINDOWTEXT
);
dc
.
SetPen
(
fg
);
dc
.
SetPen
(
fg
);
// draw pies
// draw pies
double
angle
=
0
;
double
angle
=
M_PI
/
2
;
int
i
=
0
;
int
i
=
0
;
FOR_EACH_CONST
(
g
,
axis
.
groups
)
{
FOR_EACH_CONST
(
g
,
axis
.
groups
)
{
// draw pie
// draw pie
dc
.
SetBrush
(
g
.
color
);
dc
.
SetBrush
(
g
.
color
);
if
(
g
.
size
>
0
)
{
if
(
g
.
size
>
0
)
{
double
end_angle
=
angle
+
2
*
M_PI
*
(
double
)
g
.
size
/
axis
.
total
;
double
end_angle
=
angle
-
2
*
M_PI
*
(
double
)
g
.
size
/
axis
.
total
;
dc
.
DrawEllipticArc
(
pie_pos
,
i
==
current
?
pie_size_large
:
pie_size
,
angle
,
end_
angle
);
dc
.
DrawEllipticArc
(
pie_pos
,
i
==
current
?
pie_size_large
:
pie_size
,
end_angle
,
angle
);
angle
=
end_angle
;
angle
=
end_angle
;
}
}
++
i
;
++
i
;
}
}
// draw spokes
// draw spokes
if
(
axis
.
groups
.
size
()
>
1
)
{
if
(
axis
.
groups
.
size
()
>
1
)
{
angle
=
0
;
int
i
=
0
;
double
angle
=
M_PI
/
2
;
FOR_EACH_CONST
(
g
,
axis
.
groups
)
{
FOR_EACH_CONST
(
g
,
axis
.
groups
)
{
if
(
g
.
size
>
0
)
{
if
(
true
)
{
dc
.
DrawEllipticSpoke
(
pie_pos
,
pie_size
,
angle
);
RealSize
size
=
i
==
current
||
(
i
-
1
+
(
int
)
axis
.
groups
.
size
())
%
(
int
)
axis
.
groups
.
size
()
==
current
?
pie_size_large
:
pie_size
;
angle
+=
2
*
M_PI
*
(
double
)
g
.
size
/
axis
.
total
;
dc
.
DrawEllipticSpoke
(
pie_pos
,
size
,
angle
);
angle
-=
2
*
M_PI
*
(
double
)
g
.
size
/
axis
.
total
;
}
}
++
i
;
}
}
}
}
}
}
...
@@ -417,14 +420,14 @@ int PieGraph::findItem(const RealPoint& pos, const RealRect& rect) const {
...
@@ -417,14 +420,14 @@ int PieGraph::findItem(const RealPoint& pos, const RealRect& rect) const {
if
(
delta
.
lengthSqr
()
>
size
*
size
)
{
if
(
delta
.
lengthSqr
()
>
size
*
size
)
{
return
-
1
;
// outside circle
return
-
1
;
// outside circle
}
}
double
pos_angle
=
atan2
(
-
delta
.
y
,
delta
.
x
);
// in range [-pi..pi]
double
pos_angle
=
atan2
(
-
delta
.
y
,
delta
.
x
)
-
M_PI
/
2
;
// in range [-pi..pi]
if
(
pos_angle
<
0
)
pos_angle
+=
2
*
M_PI
;
if
(
pos_angle
<
0
)
pos_angle
+=
2
*
M_PI
;
// find angle
// find angle
double
angle
=
0
;
double
angle
=
2
*
M_PI
;
int
i
=
0
;
int
i
=
0
;
FOR_EACH_CONST
(
g
,
axis
.
groups
)
{
FOR_EACH_CONST
(
g
,
axis
.
groups
)
{
angle
+
=
2
*
M_PI
*
(
double
)
g
.
size
/
axis
.
total
;
angle
-
=
2
*
M_PI
*
(
double
)
g
.
size
/
axis
.
total
;
if
(
angle
>
pos_angle
)
return
i
;
if
(
angle
<
pos_angle
)
return
i
;
++
i
;
++
i
;
}
}
return
-
1
;
//should not happen
return
-
1
;
//should not happen
...
@@ -816,7 +819,7 @@ void GraphControl::setLayout(GraphType type, bool force) {
...
@@ -816,7 +819,7 @@ void GraphControl::setLayout(GraphType type, bool force) {
}
case
GRAPH_TYPE_PIE
:
{
}
case
GRAPH_TYPE_PIE
:
{
intrusive_ptr
<
GraphContainer
>
combined
(
new
GraphContainer
());
intrusive_ptr
<
GraphContainer
>
combined
(
new
GraphContainer
());
combined
->
add
(
new_intrusive5
<
GraphWithMargins
>
(
new_intrusive1
<
PieGraph
>
(
0
),
0
,
0
,
120
,
0
));
combined
->
add
(
new_intrusive5
<
GraphWithMargins
>
(
new_intrusive1
<
PieGraph
>
(
0
),
0
,
0
,
120
,
0
));
combined
->
add
(
new_intrusive3
<
GraphLegend
>
(
0
,
ALIGN_TOP_RIGHT
,
tru
e
));
combined
->
add
(
new_intrusive3
<
GraphLegend
>
(
0
,
ALIGN_TOP_RIGHT
,
fals
e
));
graph
=
new_intrusive5
<
GraphWithMargins
>
(
combined
,
20
,
20
,
20
,
20
);
graph
=
new_intrusive5
<
GraphWithMargins
>
(
combined
,
20
,
20
,
20
,
20
);
break
;
break
;
}
case
GRAPH_TYPE_STACK
:
{
}
case
GRAPH_TYPE_STACK
:
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment