SQLite Forum

Charts
Login

Charts

(1) By Marek (mpknap) on 2020-07-11 18:15:34 [source]

I use DBBrowser for SQLITE for charts. Is there another tool with more options?

(2) By jake on 2020-07-13 00:54:34 in reply to 1 [link] [source]

I don't know of any tools, but will suggest crafting your own charts. This gives you complete control and all the options you could possibly need. I recently did this while experimenting with the SQLite shell tool compiled as WebAssembly. In these dynamic examples charts are output as SVG using only the shell tool (partially inspired by Richard Hipp's geopoly demo).

(3) By Wout Mertens (wmertens) on 2020-07-13 05:08:06 in reply to 2 [link] [source]

Oh wow, that's impressive!

One comment, this is eye-watering ;)

WITH x(x) AS(SELECT $min_x UNION ALL SELECT x+$sample_size FROM x WHERE x<$max_x)
INSERT INTO x SELECT x FROM x;

(4) By jake on 2020-07-13 12:11:45 in reply to 3 [link] [source]

Feedback acknowledged. Would this reduce the psychological harm?

SELECT $min_x+value*$sample_size x
  FROM generate_series(0, ($max_x-$min_x)/$sample_size);

(5) By Keith Medcalf (kmedcalf) on 2020-07-13 12:53:46 in reply to 4 [link] [source]

Why all the complication. Why not just:

select value as x
  from generate_series
 where start == $min_x
   and stop == $max_x
   and step == $sample_size;

or just

select value as x 
  from generate_series($min_x, $max_x, $sample_size);

you only need to do all those calculations if you are using wholenumber because wholenumber does not support setting the step size. ie:

SELECT $min_x+value*$sample_size AS x 
  FROM wholenumber
 WHERE value BETWEEN 0 AND $max_x-$min_x)/$sample_size;

(6) By jake on 2020-07-13 13:27:39 in reply to 5 [link] [source]

My first attempt at using generate_series looked like this, but the official generate_series implementation seems to only support integer parameters.

(7) By anonymous on 2020-07-14 03:22:35 in reply to 2 [link] [source]

I recently posted message [95898f0f51] to this forum with a extension to write PostScript output from SQL. Maybe you might find this useful if you want to make graphics with the SQL data.

(8) By Keith Medcalf (kmedcalf) on 2020-07-14 15:15:17 in reply to 6 [link] [source]

Yes, sorry, you are correct. Both generate_series and wholenumber only do integers, not reals.