timbod7 / haskell-chart

A 2D charting library for haskell
430 stars 85 forks source link

filled circles are not displayed in SVG output using the diagrams backend #19

Closed DougBurke closed 10 years ago

DougBurke commented 10 years ago

Filled circles (whether opaque or not) are not displayed by the diagrams SVG backend but are by the Cairo one. The code and output I get can be found at https://gist.github.com/DougBurke/8889814

The output file circles-cairo.svg has an orange line with filled circles (green, partly transparent) with a black outline. The diagrams version (circles-diagrams.svg) has the orange line and black circles, but no green fill (also tried using a fully opaque green for the fill and it also fails to be displayed).

I don't know if this is an issue with the backend code (i.e. chart) or the diagrams library itself.

Here's my package database contents and ghc/os version:

% cabal sandbox hc-pkg -- list
/var/lib/ghc/package.conf.d
   Cabal-1.16.0
   array-0.4.0.1
   base-4.6.0.1
   bin-package-db-0.0.0.0
   binary-0.5.1.1
   bytestring-0.10.0.2
   containers-0.5.0.0
   deepseq-1.3.0.1
   directory-1.2.0.1
   filepath-1.3.0.1
   ghc-7.6.3
   ghc-prim-0.3.0.0
   haskell2010-1.1.1.0
   haskell98-2.0.0.2
   hoopl-3.9.0.0
   hpc-0.6.0.0
   integer-gmp-0.5.0.0
   old-locale-1.0.0.5
   old-time-1.1.0.1
   pretty-1.1.1.0
   process-1.1.0.2
   rts-1.0
   template-haskell-2.8.0.0
   time-1.4.0.1
   unix-2.6.0.1
/home/dburke/build/ihaskell/.cabal-sandbox/x86_64-linux-ghc-7.6.3-packages.conf.d
   Boolean-0.2
   Chart-1.2
   Chart-cairo-1.2
   Chart-diagrams-1.2
   HTTP-4000.2.10
   HUnit-1.2.5.2
   HaTeX-3.10.0.0
   MemoTrie-0.6.1
   MissingH-1.2.0.2
   MonadCatchIO-transformers-0.3.1.0
   MonadRandom-0.1.12
   NumInstances-1.3
   OneTuple-0.2.1
   QuickCheck-2.6
   ReadArgs-1.2.1
   SVGFonts-1.4.0.1
   active-0.1.0.10
   aeson-0.6.2.1
   aeson-pretty-0.7.1
   ansi-terminal-0.6.1.1
   arithmoi-0.4.0.3
   async-2.0.1.5
   attoparsec-0.11.1.0
   base-unicode-symbols-0.2.2.4
   base64-bytestring-1.0.0.1
   basic-prelude-0.3.6.0
   bifunctors-4.1.1
   blaze-builder-0.3.3.2
   blaze-html-0.7.0.1
   blaze-markup-0.6.0.0
   blaze-svg-0.3.3.1
   byteable-0.1.1
   cairo-0.12.5.1
   cereal-0.3.5.2
   circle-packing-0.1.0.3
   classy-prelude-0.7.0
   cmdargs-0.10.7
   colour-2.3.3
   comonad-4.0
   contravariant-0.4.4
   cpphs-1.18
   cryptohash-0.11.2
   data-default-0.5.3
   data-default-class-0.0.1
   data-default-instances-base-0.0.1
   data-default-instances-containers-0.0.1
   data-default-instances-dlist-0.0.1
   data-default-instances-old-locale-0.0.1
   diagrams-1.0.0.1
   diagrams-cairo-1.0.1.2
   diagrams-contrib-1.1.0.1
   diagrams-core-1.0.0.1
   diagrams-lib-1.0.1
   diagrams-postscript-1.0.1.2
   diagrams-svg-1.0.1.3
   distributive-0.4
   dlist-0.6.0.1
   dual-tree-0.2.0.1
   exceptions-0.3.3
   extensible-exceptions-0.1.1.4
   fingertree-0.1.0.0
   force-layout-0.3
   free-4.5
   generic-deriving-1.6.2
   ghc-parser-0.1.1.0
   ghc-paths-0.1.0.9
   ghci-lib-0.1.0.0
   groupoids-4.0
   groups-0.4.0.0
   hashable-1.2.1.0
   haskeline-0.7.1.2
   haskell-src-exts-1.14.0.1
   haskell-src-meta-0.6.0.5
   here-1.2.3
   hlint-1.8.57
   hscolour-1.20.3
   hslogger-1.2.3
   hspec-1.8.1.1
   hspec-expectations-0.5.0.1
   ihaskell-0.3.0.4
   ihaskell-aeson-0.1.0.0
   ihaskell-basic-0.1.0.0
   ihaskell-blaze-0.1.0.0
   ihaskell-charts-0.1.0.0
   ihaskell-diagrams-0.1.0.0
   ihaskell-hatex-0.1.0.0
   ihaskell-magic-0.1.0.0
   intervals-0.4.1
   ipython-kernel-0.1.0.0
   keys-3.10
   lens-3.10.1
   lifted-base-0.2.1.1
   magic-1.0.8
   matrix-0.2.4.0
   monad-control-0.3.2.2
   monads-tf-0.1.0.1
   mono-traversable-0.2.0.0
   monoid-extras-0.3.2.4
   mtl-2.1.2
   nats-0.1.2
   network-2.4.2.2
   network-info-0.2.0.3
   newtype-0.2
   operational-0.2.2.1
   optparse-applicative-0.7.0.2
   parallel-3.2.0.4
   parsec-3.1.5
   pointed-4.0
   primitive-0.5.1.0
   profunctors-4.0.2
   quickcheck-io-0.1.0
   random-1.0.1.1
   reflection-1.4
   regex-base-0.93.2
   regex-compat-0.95.1
   regex-posix-0.95.2
   safe-0.3.4
   scientific-0.2.0.1
   semigroupoids-4.0
   semigroups-0.12.2
   setenv-0.1.1.1
   shelly-1.4.4
   split-0.2.2
   statestack-0.2
   stm-2.4.2
   strict-0.3.2
   syb-0.4.1
   system-argv0-0.1.1
   system-fileio-0.3.12
   system-filepath-0.4.9
   tagged-0.7
   tar-0.4.0.1
   terminfo-0.4.0.0
   text-1.1.0.0
   th-lift-0.5.6
   th-orphans-0.8
   transformers-0.3.0.0
   transformers-base-0.4.1
   transformers-compat-0.1.1.1
   tuple-0.2.0.1
   uniplate-1.6.12
   unix-compat-0.4.1.1
   unordered-containers-0.2.3.3
   utf8-string-0.3.7
   uuid-1.3.3
   vector-0.10.9.1
   vector-instances-3.3
   vector-space-0.8.6
   vector-space-points-0.1.3
   void-0.6.1
   xml-1.3.13
   zeromq4-haskell-0.2

% ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.6.3
% uname -a
Linux brobdingnag 3.11.0-15-generic #25-Ubuntu SMP Thu Jan 30 17:22:01 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
timbod7 commented 10 years ago

Thanks for the report. This appears to be a problem introduced with the migration to diagrams version 1.0.

Are you able to confirm that the problem is resolve by reverting to an older version of diagrams? You should be able to do this by constraining diagrams-core to version 0.7.0.1.

DougBurke commented 10 years ago

Yes, the SVG output from the diagrams back end is correct if I change the cabal file to

      -- Chart           >= 1.2 && < 1.3,
      -- Chart-cairo     >= 1.2 && < 1.3,
      -- Chart-diagrams  >= 1.2 && < 1.3
      diagrams-core == 0.7.0.1, Chart, Chart-cairo, Chart-diagrams

and then do a complete re-install, so that I have

%  cabal sandbox hc-pkg list | egrep 'Chart|diagram'
    Chart-1.2
    Chart-cairo-1.2
    Chart-diagrams-1.2
    diagrams-core-0.7.0.1
    diagrams-lib-0.7.1.1
    diagrams-postscript-0.7.0.2
    diagrams-svg-0.8.0.2
DougBurke commented 10 years ago

I've created a new gist with the SVG diagrams output for the diagrams-core-0.7.0.1: https://gist.github.com/8923417

timbod7 commented 10 years ago

It looks indeed like it is a problem with the svg driver in 1.0 diagrams. The issue is here:

https://github.com/diagrams/diagrams-svg/issues/43

and associated discussion here:

http://projects.haskell.org/pipermail/chart/2014-February/000169.html

DougBurke commented 10 years ago

Ta for the info - Doug

On Wed, Feb 12, 2014 at 6:55 AM, Tim Docker notifications@github.comwrote:

It looks indeed like it is a problem with the svg driver in 1.0 diagrams. The issue is here:

diagrams/diagrams-svg#43https://github.com/diagrams/diagrams-svg/issues/43

and associated discussion here:

http://projects.haskell.org/pipermail/chart/2014-February/000169.html

Reply to this email directly or view it on GitHubhttps://github.com/timbod7/haskell-chart/issues/19#issuecomment-34861855 .

byorgey commented 10 years ago

This issue should be fixed in diagrams-svg-1.0.2, which comes with the latest release of diagrams (diagrams-1.1).

DougBurke commented 10 years ago

Since diagrams-lib-1.1 depends on lens==4.0.* then I think this will have to wait until the lens-4.0 changes are added back in to Chart. Or at least I couldn't build Chart with the new version of diagrams because of this constraint.

byorgey commented 10 years ago

I've opened https://github.com/timbod7/haskell-chart/pull/25 which updates Chart to work with the new version of diagrams. Note no changes were required to allow Chart to build with lens-4.0; only some small changes were needed to make it compatible with diagrams-lib-1.1.

timbod7 commented 10 years ago

Looks like this problem is sorted - thanks Brent.