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
7df1cfa6
Commit
7df1cfa6
authored
Jul 21, 2010
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed #24: nullptr error in graph code
parent
921a36de
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
5 deletions
+26
-5
src/gui/control/graph.cpp
src/gui/control/graph.cpp
+25
-5
src/gui/control/graph.hpp
src/gui/control/graph.hpp
+1
-0
No files found.
src/gui/control/graph.cpp
View file @
7df1cfa6
...
...
@@ -284,12 +284,24 @@ bool Graph1D::findItem(const RealPoint& pos, const RealRect& rect, bool tight, v
}
}
void
Graph1D
::
setData
(
const
GraphDataP
&
d
)
{
if
(
d
->
axes
.
size
()
<=
axis
)
{
Graph
::
setData
(
GraphDataP
());
// invalid
}
else
{
Graph
::
setData
(
d
);
}
}
// ----------------------------------------------------------------------------- : Graph2D
void
Graph2D
::
setData
(
const
GraphDataP
&
d
)
{
Graph
::
setData
(
d
);
if
(
data
->
axes
.
size
()
<=
max
(
axis1
,
axis2
))
return
;
d
->
crossAxis
(
axis1
,
axis2
,
values
);
if
(
d
->
axes
.
size
()
<=
max
(
axis1
,
axis2
))
{
Graph
::
setData
(
GraphDataP
());
// invalid
}
else
{
Graph
::
setData
(
d
);
d
->
crossAxis
(
axis1
,
axis2
,
values
);
}
}
// ----------------------------------------------------------------------------- : Bar Graph
...
...
@@ -620,6 +632,7 @@ bool ScatterGraph::findItem(const RealPoint& pos, const RealRect& rect, bool tig
void
ScatterGraph
::
setData
(
const
GraphDataP
&
d
)
{
Graph2D
::
setData
(
d
);
if
(
!
data
)
return
;
if
(
values
.
empty
())
return
;
// find maximum
max_value
=
0
;
...
...
@@ -656,13 +669,17 @@ void ScatterGraph::setData(const GraphDataP& d) {
void
ScatterGraphPlus
::
setData
(
const
GraphDataP
&
d
)
{
ScatterGraph
::
setData
(
d
);
if
(
data
->
axes
.
size
()
<=
max
(
max
(
axis1
,
axis2
),
axis3
))
return
;
d
->
crossAxis
(
axis1
,
axis2
,
axis3
,
values3D
);
if
(
!
data
||
data
->
axes
.
size
()
<=
max
(
max
(
axis1
,
axis2
),
axis3
))
{
data
=
GraphDataP
();
// invalid
return
;
}
data
->
crossAxis
(
axis1
,
axis2
,
axis3
,
values3D
);
}
// ----------------------------------------------------------------------------- : Scatter Pie graph
void
ScatterPieGraph
::
draw
(
RotatedDC
&
dc
,
const
vector
<
int
>&
current
,
DrawLayer
layer
)
const
{
if
(
!
data
)
return
;
if
(
data
->
axes
.
size
()
<=
max
(
max
(
axis1
,
axis2
),
axis3
))
return
;
if
(
layer
==
LAYER_SELECTION
)
{
ScatterGraph
::
draw
(
dc
,
current
,
layer
);
...
...
@@ -711,6 +728,7 @@ void ScatterPieGraph::draw(RotatedDC& dc, const vector<int>& current, DrawLayer
void
GraphStats
::
setData
(
const
GraphDataP
&
d
)
{
Graph1D
::
setData
(
d
);
if
(
!
data
)
return
;
// update values
GraphAxis
&
axis
=
axis_data
();
values
.
clear
();
...
...
@@ -822,6 +840,7 @@ int GraphLegend::findItem(const RealPoint& pos, const RealRect& rect, bool tight
// ----------------------------------------------------------------------------- : Graph label axis
void
GraphLabelAxis
::
draw
(
RotatedDC
&
dc
,
int
current
,
DrawLayer
layer
)
const
{
if
(
!
data
)
return
;
RealRect
rect
=
dc
.
getInternalRect
();
GraphAxis
&
axis
=
axis_data
();
int
count
=
int
(
axis
.
groups
.
size
());
...
...
@@ -901,6 +920,7 @@ void GraphLabelAxis::draw(RotatedDC& dc, int current, DrawLayer layer) const {
}
}
int
GraphLabelAxis
::
findItem
(
const
RealPoint
&
pos
,
const
RealRect
&
rect
,
bool
tight
)
const
{
if
(
!
data
)
return
-
1
;
GraphAxis
&
axis
=
axis_data
();
int
col
;
if
(
direction
==
HORIZONTAL
)
{
...
...
src/gui/control/graph.hpp
View file @
7df1cfa6
...
...
@@ -160,6 +160,7 @@ class Graph1D : public Graph {
inline
Graph1D
(
size_t
axis
)
:
axis
(
axis
)
{}
virtual
void
draw
(
RotatedDC
&
dc
,
const
vector
<
int
>&
current
,
DrawLayer
layer
)
const
;
virtual
bool
findItem
(
const
RealPoint
&
pos
,
const
RealRect
&
rect
,
bool
tight
,
vector
<
int
>&
out
)
const
;
virtual
void
setData
(
const
GraphDataP
&
d
);
protected:
size_t
axis
;
/// Find an item, return the position along the axis, or -1 if not found
...
...
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