13 #ifndef QmitkChartData_h
14 #define QmitkChartData_h
18 #include <QApplication>
21 #include <QFileDialog>
22 #include <boost/algorithm/string.hpp>
70 void SetAppearance(
bool showSubChart =
true,
bool usePercentageInPieChart =
false);
310 QString ds = QUrl::fromPercentEncoding(datafromjs.toLatin1());
312 QString filename = QFileDialog::getSaveFileName(
316 tr(
"Scalable Vector Graphics (*.svg)") );
317 if (filename.isEmpty())
320 std::string out_image = ds.toStdString();
321 boost::algorithm::replace_first(out_image,
"data:image/svg+xml,",
"");
322 std::ofstream outfile(filename.toStdString());
323 outfile.write(out_image.c_str(), out_image.size());
339 QVariant m_numberDatasets;
Holds global chart properties for chart generation via QWebChannel.
Q_INVOKABLE QVariant GetShowErrorBars() const
Get whether error bars are shown.
void SignalStackedDataChanged(const QVariant stackedData)
Emitted when stacked data mode changes.
Q_INVOKABLE void SetMinValueYView(const QVariant &minValueYView)
Set the minimum Y axis view value for zooming.
Q_INVOKABLE QVariant GetMinValueYView() const
Get the minimum Y axis view value.
void SignalImageUrl()
Emitted to request the chart image URL from JavaScript for SVG export.
Q_INVOKABLE void SetStackedData(const QVariant &stackedData)
Set whether data is displayed in stacked mode.
Q_INVOKABLE QVariant GetShowSubchart() const
Get whether the subchart (overview navigator) is shown.
void SignalXAxisLabelChanged(const QVariant label)
Emitted when the X axis label changes.
Q_INVOKABLE void SetXAxisLabel(const QVariant &label)
Set the X axis label text.
Q_INVOKABLE void SetMaxValueXView(const QVariant &maxValueXView)
Set the maximum X axis view value for zooming.
void SignalDataPointSizeChanged(const QVariant showDataPoints)
Emitted when data point size changes.
Q_INVOKABLE void SetTitle(const QVariant &title)
Set the chart title.
Q_INVOKABLE QVariant GetXAxisLabel() const
Get the X axis label text.
QmitkChartData()
Construct a QmitkChartData with default property values.
void SignalUsePercentageInPieChartChanged(const QVariant usePercentageInPieChart)
Emitted when pie chart percentage mode changes.
void SignalThemeNameChanged(const QVariant themeName)
Emitted when the theme changes.
void SignalLegendPositionChanged(const QVariant legendPosition)
Emitted when the legend position changes.
Q_INVOKABLE QVariant GetYAxisScale() const
Get the Y axis scale type.
void SignalShowSubchartChanged(const QVariant showSubchart)
Emitted when subchart visibility changes.
Q_INVOKABLE void SetYAxisLabel(const QVariant &label)
Set the Y axis label text.
void EmitSignalImageUrl()
Emit the SignalImageUrl signal to trigger SVG export in JavaScript.
void SignalMaxValueXViewChanged(const QVariant maxValueXView)
Emitted when maximum X view value changes.
void slotImageUrl(const QString &datafromjs)
Slot that receives an SVG image URL from JavaScript and saves it to a file.
QVariant m_UsePercentageInPieChart
Q_INVOKABLE void SetThemeName(const QVariant &themeName)
Set the chart theme name.
Q_INVOKABLE QVariant GetTitle() const
Get the chart title.
Q_INVOKABLE void SetMaxValueYView(const QVariant &maxValueYView)
Set the maximum Y axis view value for zooming.
void SignalShowLegendChanged(const QVariant show)
Emitted when legend visibility changes.
Q_INVOKABLE void SetShowErrorBars(const QVariant &show)
Set whether error bars are shown.
Q_INVOKABLE QVariant GetYAxisLabel() const
Get the Y axis label text.
Q_INVOKABLE void SetDataPointSize(const QVariant &showDataPoints)
Set the data point marker size.
Q_INVOKABLE void SetMinValueXView(const QVariant &minValueXView)
Set the minimum X axis view value for zooming.
Q_INVOKABLE void SetShowSubchart(const QVariant &showSubchart)
Set whether the subchart (overview navigator) is shown.
Q_INVOKABLE QVariant GetLegendPosition() const
Get the legend position.
void SignalYAxisLabelChanged(const QVariant label)
Emitted when the Y axis label changes.
Q_INVOKABLE void SetShowLegend(const QVariant &show)
Set whether the legend is shown.
Q_INVOKABLE QVariant GetUsePercentageInPieChart() const
Get whether percentages are shown in pie charts.
void SetAppearance(bool showSubChart=true, bool usePercentageInPieChart=false)
Configure appearance-related properties in a single call.
void SignalMaxValueYViewChanged(const QVariant maxValueYView)
Emitted when maximum Y view value changes.
Q_INVOKABLE void SetLegendPosition(const QVariant &legendPosition)
Set the legend position.
void SignalShowErrorBarsChanged(const QVariant show)
Emitted when error bar visibility changes.
Q_INVOKABLE void SetUsePercentageInPieChart(const QVariant &usePercentageInPieChart)
Set whether percentages are shown in pie charts.
void SignalTitleChanged(const QVariant title)
Emitted when the chart title changes.
Q_INVOKABLE QVariant GetMinValueXView() const
Get the minimum X axis view value.
void SignalMinValueYViewChanged(const QVariant minValueYView)
Emitted when minimum Y view value changes.
Q_INVOKABLE void SetYAxisScale(const QVariant &YAxisScale)
Set the Y axis scale type.
QVariant m_LegendPosition
void SignalMinValueXViewChanged(const QVariant minValueXView)
Emitted when minimum X view value changes.
Q_INVOKABLE QVariant GetStackedData() const
Get whether data is displayed in stacked mode.
Q_INVOKABLE QVariant GetThemeName() const
Get the current theme name.
Q_INVOKABLE QVariant GetShowLegend() const
Get whether the legend is shown.
Q_INVOKABLE QVariant GetDataPointSize() const
Get the data point marker size.
Q_INVOKABLE QVariant GetMaxValueYView() const
Get the maximum Y axis view value.
Q_INVOKABLE QVariant GetMaxValueXView() const
Get the maximum X axis view value.
void SignalYAxisScaleChanged(const QVariant YAxisScale)
Emitted when the Y axis scale changes.