From 8c438ba08bf0761c1251a6c46c5981076067e392 Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Fri, 7 Jul 2017 02:17:17 +0200 Subject: [PATCH] SVG tests --- pages/statistics/statistics.pixy | 12 +++++++++--- utils/SVGPieChartPath.go | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/pages/statistics/statistics.pixy b/pages/statistics/statistics.pixy index 269e5a05..890c8af1 100644 --- a/pages/statistics/statistics.pixy +++ b/pages/statistics/statistics.pixy @@ -8,6 +8,12 @@ component Statistics(screenSizes []*utils.AnalyticsItem) component PieChart svg.graph(viewBox="-1.05 -1.05 2.1 2.1") - path.slice.slice-1(d=utils.SVGSlicePath(0, 0.5)) - path.slice.slice-2(d=utils.SVGSlicePath(0.5, 0.8)) - path.slice.slice-3(d=utils.SVGSlicePath(0.8, 1.0)) \ No newline at end of file + g + title Demo (50%) + path.slice.slice-1(d=utils.SVGSlicePath(0, 0.5)) + g + title Demo (30%) + path.slice.slice-2(d=utils.SVGSlicePath(0.5, 0.8)) + g + title Demo (20%) + path.slice.slice-3(d=utils.SVGSlicePath(0.8, 1.0)) \ No newline at end of file diff --git a/utils/SVGPieChartPath.go b/utils/SVGPieChartPath.go index cc3e2b3a..b349fe46 100644 --- a/utils/SVGPieChartPath.go +++ b/utils/SVGPieChartPath.go @@ -23,5 +23,5 @@ func SVGSlicePath(from float64, to float64) string { largeArc = "1" } - return fmt.Sprintf("M %.2f %.2f A 1 1 0 %s 1 %.2f %.2f L 0 0", x1, y1, largeArc, x2, y2) + return fmt.Sprintf("M %.3f %.3f A 1 1 0 %s 1 %.3f %.3f L 0 0", x1, y1, largeArc, x2, y2) }