Add an image_size parameter to ag_chart_create_svg()
This is required so we can generate a fixed size image, e.g. for the chart preview.
This commit is contained in:
parent
84b622c622
commit
6d996af704
@ -1417,6 +1417,7 @@ ag_chart_create_svg(AgChart *chart,
|
|||||||
gsize *length,
|
gsize *length,
|
||||||
gboolean rendering,
|
gboolean rendering,
|
||||||
AgDisplayTheme *theme,
|
AgDisplayTheme *theme,
|
||||||
|
guint image_size,
|
||||||
GError **err)
|
GError **err)
|
||||||
{
|
{
|
||||||
xmlDocPtr doc = create_save_doc(chart),
|
xmlDocPtr doc = create_save_doc(chart),
|
||||||
@ -1762,9 +1763,15 @@ ag_chart_create_svg(AgChart *chart,
|
|||||||
params[3] = g_strdup_printf("\"%s\"", css);
|
params[3] = g_strdup_printf("\"%s\"", css);
|
||||||
g_free(css);
|
g_free(css);
|
||||||
params[4] = "chart-size";
|
params[4] = "chart-size";
|
||||||
params[5] = g_strdup_printf("%d", AG_CHART_DEFAULT_RING_SIZE);
|
|
||||||
params[6] = "image-size";
|
params[6] = "image-size";
|
||||||
params[7] = "0";
|
|
||||||
|
if (image_size == 0) {
|
||||||
|
params[5] = g_strdup_printf("%d", AG_CHART_DEFAULT_RING_SIZE);
|
||||||
|
params[7] = g_strdup("0");
|
||||||
|
} else {
|
||||||
|
params[5] = g_strdup("0");
|
||||||
|
params[7] = g_strdup_printf("%d", image_size);
|
||||||
|
}
|
||||||
params[8] = "icon-size";
|
params[8] = "icon-size";
|
||||||
params[9] = g_strdup_printf("%d", AG_CHART_DEFAULT_ICON_SIZE);
|
params[9] = g_strdup_printf("%d", AG_CHART_DEFAULT_ICON_SIZE);
|
||||||
|
|
||||||
@ -1781,6 +1788,7 @@ ag_chart_create_svg(AgChart *chart,
|
|||||||
xmlFreeDoc(doc);
|
xmlFreeDoc(doc);
|
||||||
g_free(params[3]);
|
g_free(params[3]);
|
||||||
g_free(params[5]);
|
g_free(params[5]);
|
||||||
|
g_free(params[7]);
|
||||||
g_free(params[9]);
|
g_free(params[9]);
|
||||||
g_free(params);
|
g_free(params);
|
||||||
|
|
||||||
@ -1819,7 +1827,14 @@ ag_chart_export_svg_to_file(AgChart *chart,
|
|||||||
gchar *svg;
|
gchar *svg;
|
||||||
gsize length;
|
gsize length;
|
||||||
|
|
||||||
if ((svg = ag_chart_create_svg(chart, &length, TRUE, theme, err)) == NULL) {
|
if ((svg = ag_chart_create_svg(
|
||||||
|
chart,
|
||||||
|
&length,
|
||||||
|
TRUE,
|
||||||
|
theme,
|
||||||
|
0,
|
||||||
|
err
|
||||||
|
)) == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1854,6 +1869,7 @@ ag_chart_export_jpg_to_file(AgChart *chart,
|
|||||||
&svg_length,
|
&svg_length,
|
||||||
TRUE,
|
TRUE,
|
||||||
theme,
|
theme,
|
||||||
|
0,
|
||||||
err
|
err
|
||||||
)) == NULL) {
|
)) == NULL) {
|
||||||
return;
|
return;
|
||||||
|
@ -120,6 +120,7 @@ gchar *ag_chart_create_svg(AgChart *chart,
|
|||||||
gsize *length,
|
gsize *length,
|
||||||
gboolean rendering,
|
gboolean rendering,
|
||||||
AgDisplayTheme *theme,
|
AgDisplayTheme *theme,
|
||||||
|
guint image_size,
|
||||||
GError **err);
|
GError **err);
|
||||||
|
|
||||||
GList *ag_chart_get_planets(AgChart *chart);
|
GList *ag_chart_get_planets(AgChart *chart);
|
||||||
|
@ -532,6 +532,7 @@ ag_window_redraw_chart(AgWindow *window)
|
|||||||
&length,
|
&length,
|
||||||
FALSE,
|
FALSE,
|
||||||
NULL,
|
NULL,
|
||||||
|
0,
|
||||||
&err
|
&err
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user