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
aca08658
Commit
aca08658
authored
May 14, 2007
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Legends for graphs; pie scatter graphs
parent
084bf12e
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
231 additions
and
16 deletions
+231
-16
src/data/graph_type.hpp
src/data/graph_type.hpp
+1
-0
src/data/statistics.cpp
src/data/statistics.cpp
+5
-4
src/gui/control/graph.cpp
src/gui/control/graph.cpp
+173
-9
src/gui/control/graph.hpp
src/gui/control/graph.hpp
+37
-3
src/util/real_point.hpp
src/util/real_point.hpp
+15
-0
No files found.
src/data/graph_type.hpp
View file @
aca08658
...
...
@@ -19,6 +19,7 @@ enum GraphType
,
GRAPH_TYPE_PIE
,
GRAPH_TYPE_STACK
,
GRAPH_TYPE_SCATTER
,
GRAPH_TYPE_SCATTER_PIE
};
// ----------------------------------------------------------------------------- : EOF
...
...
src/data/statistics.cpp
View file @
aca08658
...
...
@@ -119,8 +119,9 @@ void StatsCategory::find_dimensions(const vector<StatsDimensionP>& available) {
// ----------------------------------------------------------------------------- : GraphType (from graph_type.hpp)
IMPLEMENT_REFLECTION_ENUM
(
GraphType
)
{
VALUE_N
(
"bar"
,
GRAPH_TYPE_BAR
);
VALUE_N
(
"pie"
,
GRAPH_TYPE_PIE
);
VALUE_N
(
"stack"
,
GRAPH_TYPE_STACK
);
VALUE_N
(
"scatter"
,
GRAPH_TYPE_SCATTER
);
VALUE_N
(
"bar"
,
GRAPH_TYPE_BAR
);
VALUE_N
(
"pie"
,
GRAPH_TYPE_PIE
);
VALUE_N
(
"stack"
,
GRAPH_TYPE_STACK
);
VALUE_N
(
"scatter"
,
GRAPH_TYPE_SCATTER
);
VALUE_N
(
"scatter pie"
,
GRAPH_TYPE_SCATTER_PIE
);
}
src/gui/control/graph.cpp
View file @
aca08658
This diff is collapsed.
Click to expand it.
src/gui/control/graph.hpp
View file @
aca08658
...
...
@@ -100,6 +100,8 @@ class GraphData : public IntrusivePtrBase<GraphData> {
/// Create a cross table for two axes
void
crossAxis
(
size_t
axis1
,
size_t
axis2
,
vector
<
UInt
>&
out
)
const
;
/// Create a cross table for three axes
void
crossAxis
(
size_t
axis1
,
size_t
axis2
,
size_t
axis3
,
vector
<
UInt
>&
out
)
const
;
};
...
...
@@ -117,6 +119,8 @@ enum DrawLayer
/** It is rendered into a sub-rectangle of the screen */
class
Graph
:
public
IntrusivePtrVirtualBase
{
public:
/// Determine the size of this graph viewer, return -1 if the viewer stretches
virtual
RealSize
determineSize
(
RotatedDC
&
dc
)
const
{
return
RealSize
(
-
1
,
-
1
);
}
/// Draw this graph, filling the internalRect() of the dc.
virtual
void
draw
(
RotatedDC
&
dc
,
const
vector
<
int
>&
current
,
DrawLayer
layer
)
const
=
0
;
/// Find the item at the given position, the rectangle gives the screen size
...
...
@@ -188,16 +192,41 @@ class ScatterGraph : public Graph2D {
virtual
void
draw
(
RotatedDC
&
dc
,
const
vector
<
int
>&
current
,
DrawLayer
layer
)
const
;
virtual
bool
findItem
(
const
RealPoint
&
pos
,
const
RealRect
&
rect
,
vector
<
int
>&
out
)
const
;
virtual
void
setData
(
const
GraphDataP
&
d
);
pr
ivate
:
pr
otected
:
UInt
max_value
;
///< highest value
};
/// A scatter plot with an extra dimension
class
ScatterGraphPlus
:
public
ScatterGraph
{
public:
inline
ScatterGraphPlus
(
size_t
axis1
,
size_t
axis2
,
size_t
axis3
)
:
ScatterGraph
(
axis1
,
axis2
),
axis3
(
axis3
)
{}
virtual
void
setData
(
const
GraphDataP
&
d
);
protected:
size_t
axis3
;
vector
<
UInt
>
values3D
;
// axis1.size * axis2.size * axis3.size array
inline
GraphAxis
&
axis3_data
()
const
{
return
*
data
->
axes
.
at
(
axis3
);
}
};
/// A scatter plot with a pie graph for the third dimension
class
ScatterPieGraph
:
public
ScatterGraphPlus
{
public:
inline
ScatterPieGraph
(
size_t
axis1
,
size_t
axis2
,
size_t
axis3
)
:
ScatterGraphPlus
(
axis1
,
axis2
,
axis3
)
{}
virtual
void
draw
(
RotatedDC
&
dc
,
const
vector
<
int
>&
current
,
DrawLayer
layer
)
const
;
};
/// The legend, used for pie graphs
class
GraphLegend
:
public
Graph1D
{
public:
inline
GraphLegend
(
size_t
axis
)
:
Graph1D
(
axis
)
{}
inline
GraphLegend
(
size_t
axis
,
Alignment
alignment
,
bool
reverse
=
false
)
:
Graph1D
(
axis
),
alignment
(
alignment
),
reverse
(
reverse
)
{}
virtual
RealSize
determineSize
(
RotatedDC
&
dc
)
const
;
virtual
void
draw
(
RotatedDC
&
dc
,
int
current
,
DrawLayer
layer
)
const
;
virtual
int
findItem
(
const
RealPoint
&
pos
,
const
RealRect
&
rect
)
const
;
private:
mutable
RealSize
size
,
item_size
;
Alignment
alignment
;
bool
reverse
;
};
//class GraphTable {
...
...
@@ -228,8 +257,10 @@ class GraphLabelAxis : public Graph1D {
/// Draws an a vertical axis for counts
class
GraphValueAxis
:
public
Graph1D
{
public:
inline
GraphValueAxis
(
size_t
axis
)
:
Graph1D
(
axis
)
{}
inline
GraphValueAxis
(
size_t
axis
,
bool
highlight_value
)
:
Graph1D
(
axis
),
highlight_value
(
highlight_value
)
{}
virtual
void
draw
(
RotatedDC
&
dc
,
int
current
,
DrawLayer
layer
)
const
;
private:
bool
highlight_value
;
};
/// A graph with margins
...
...
@@ -296,6 +327,9 @@ class GraphControl : public wxControl {
void
onPaint
(
wxPaintEvent
&
);
void
onSize
(
wxSizeEvent
&
);
void
onMouseDown
(
wxMouseEvent
&
ev
);
void
onChar
(
wxKeyEvent
&
ev
);
void
onSelectionChange
();
};
// ----------------------------------------------------------------------------- : EOF
...
...
src/util/real_point.hpp
View file @
aca08658
...
...
@@ -96,6 +96,21 @@ inline RealSize add_diagonal(const RealSize& a, const RealSize& b) {
return
RealSize
(
a
.
width
+
b
.
width
,
a
.
height
+
b
.
height
);
}
/// Piecewise minimum
inline
RealSize
piecewise_min
(
const
RealSize
&
a
,
const
RealSize
&
b
)
{
return
RealSize
(
a
.
width
<
b
.
width
?
a
.
width
:
b
.
width
,
a
.
height
<
b
.
height
?
a
.
height
:
b
.
height
);
}
/// Piecewise maximum
inline
RealSize
piecewise_max
(
const
RealSize
&
a
,
const
RealSize
&
b
)
{
return
RealSize
(
a
.
width
<
b
.
width
?
b
.
width
:
a
.
width
,
a
.
height
<
b
.
height
?
b
.
height
:
a
.
height
);
}
// ----------------------------------------------------------------------------- : Rectangle using doubles
/// A rectangle (postion and size) using real (double) coordinats
...
...
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