Skip to content

Commit ed003aa

Browse files
committed
Coordsystem can be get from Chart.
1 parent 3db3018 commit ed003aa

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

src/chart/main/chart.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,23 @@ Diag::DiagramPtr Chart::diagram(
118118
stylesheet.getFullParams());
119119
}
120120

121+
Draw::CoordinateSystem Chart::getCoordSystem() const
122+
{
123+
const auto &plotArea = layout.plotArea;
124+
125+
if (actDiagram)
126+
{
127+
const auto &options = *actDiagram->getOptions();
128+
129+
return Draw::CoordinateSystem(plotArea,
130+
options.angle.get(),
131+
options.polar.get(),
132+
actDiagram->keepAspectRatio);
133+
}
134+
return Draw::CoordinateSystem(plotArea, 0.0,
135+
Math::FuzzyBool(), Math::FuzzyBool());
136+
}
137+
121138
const Diag::Marker *Chart::markerAt(const Geom::Point &point) const
122139
{
123140
if (animator->isRunning()) return nullptr;

src/chart/main/chart.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "chart/main/layout.h"
1515
#include "chart/main/stylesheet.h"
1616
#include "chart/options/descriptor.h"
17+
#include "chart/rendering/painter/coordinatesystem.h"
1718
#include "data/table/datatable.h"
1819
#include "events.h"
1920

@@ -40,6 +41,7 @@ class Chart :
4041
Anim::Options &getAnimOptions() { return nextAnimOptions; }
4142
Events &getEvents() { return events; }
4243
Util::EventDispatcher &getEventDispatcher() { return eventDispatcher; }
44+
Draw::CoordinateSystem getCoordSystem() const;
4345

4446
Diag::Descriptor getDescriptor();
4547

0 commit comments

Comments
 (0)