spotifyovercastrssapple-podcasts

elm-charts

Tereza joins us to talk about building charts in Elm using the new elm-charts package.
September 13, 2021
#39

Transcript

[00:00:00]
Hello Jeroen. Hello Dillon. And today we're joined by Teresa Sokal. Teresa, thanks so
[00:00:06]
much for joining us. Welcome. Thank you for having me. It's a pleasure. We're excited
[00:00:12]
to talk about these beautiful charts that everybody's tweeting about. I think just like
[00:00:20]
this landing page is so beautiful it makes you want to play around with charts. Thank
[00:00:24]
you. Yeah, actually like it took me so long to settle on what the look should be for the
[00:00:31]
front page. I feel like that's always what delays me like, like doing a release is just
[00:00:37]
like the small details of that. Evan was like, you know, he was going crazy. It was just
[00:00:44]
it looks beautiful. Everything, anything you do will look good. But I'm like, what if I
[00:00:50]
put this chart over here instead? Whatever your process was, it worked. And you've got
[00:00:56]
all these like nice examples in line in the site. It's very cool. Yay, thank you. I'm
[00:01:00]
so glad to hear. So let's so we'd like to start with like, definitions, introductions
[00:01:07]
and concepts. So why don't you tell us like what what is Elm charts? What what's it for?
[00:01:13]
And how do you build charts with it? Cool. Yeah, Elm charts is sort of a high level charting
[00:01:19]
library. So it's a charting library that compiles directly or like produces SVG directly in
[00:01:26]
Elm. And you don't have to know any SVG to work with it, which was one of my goals as
[00:01:33]
well was just to make it like just like people who don't know anything about charts should
[00:01:38]
be able to make a chart with Elm charts. So yeah, that was the primary goal. And then
[00:01:44]
to make it like really customizable. I've had like in my chart story sort of starts
[00:01:51]
back in my job at upbeat quite a few years ago, where we had a lot of charts and I would
[00:01:58]
use like react libraries because that was I was still doing react back then. And they
[00:02:04]
were actually like pretty nice. But there will always be like a fatal flaw. I think
[00:02:10]
I missed a feature of some sort that like totally like like that made me like they would
[00:02:16]
not be able to do what I needed to do in the design of the library. Yeah, exactly. Exactly.
[00:02:23]
And it didn't have like the appropriate holes to like go so I can do it myself. So I've
[00:02:30]
sort of tried to do that. Of course, it's hard to anticipate like no, no shade to the
[00:02:36]
react like they they were very inspiring. And I've gotten a lot of design features from
[00:02:44]
them. But there was just like, it's hard to anticipate what people would need because
[00:02:48]
charts is such an enormous like area like and there's just like so many charts you can
[00:02:54]
make and people will like, Oh, like, how do I do this? And I was like, I had no idea that
[00:02:58]
anybody would want to do that. I was like, No, okay, I'll figure it out, which is also
[00:03:05]
what makes it a quite a challenging API to design is that you have to design for so many
[00:03:11]
use cases and still keep it like manageable. So yeah, that was actually that's why it has
[00:03:19]
had such a like, so many API designs throughout time, like the first charting library that
[00:03:26]
I made came out when I first started at Nord inc, which is like five years ago, four years
[00:03:32]
ago or something. I'm not quite sure. But there were a few right there was like, elm
[00:03:38]
plot online. Yeah, exactly. So the funny thing is that I actually kind of just went back
[00:03:46]
to the original API of like, hmm. So if you look at them, that thing is pretty similar
[00:03:54]
to what it is now a lot of the like, it's just like, you know, the sort of look alike
[00:04:02]
HTML API that has attributes and that sort of thing. I like to think that the one I made
[00:04:07]
now is slightly better. More features than the original, but yes, but then I was like,
[00:04:16]
that was like such a new beginning of my life. And I like just like learning to design libraries,
[00:04:23]
it was the first library ever published. So I would like listen to a lot of people who
[00:04:29]
had like, we didn't really necessarily know anything about charts, but just like, Oh,
[00:04:33]
wouldn't it be cool to do the design like this? And I was like, Well, you probably know
[00:04:36]
better. I ended up actually going against my own intuition. So the line charts API is
[00:04:44]
sort of goes away from the attributes and just has like a configuration. And I think
[00:04:50]
it's very limiting and pretty confusing because you sort of overwhelmed with so many configuration
[00:04:56]
options.
[00:04:57]
You mean like passing into records where you can say...
[00:05:00]
Yeah, exactly. Exactly. Instead of passing in like...
[00:05:05]
Modifiers.
[00:05:06]
Yeah.
[00:05:07]
So the attributes is like kind of familiar from the like, Elm HTML attributes a little
[00:05:14]
bit like a list of attributes.
[00:05:16]
Yeah, exactly. So they modify the configuration.
[00:05:19]
Yeah, underneath it's kind of it's also just a record of like configuration record.
[00:05:26]
Right.
[00:05:27]
So it's actually not that different. It just hides the fact that like, you're not so you're
[00:05:32]
not confronted with so many configuration options in the very beginning.
[00:05:37]
That makes sense. Yeah, it looks like they're all basically just little like record setter
[00:05:42]
functions.
[00:05:43]
Yeah, yeah. I just went with the most basic setup. I don't know if there's actually a
[00:05:50]
better way. It does have like serious drawbacks in some sense to do that way as Sharun and
[00:05:56]
I talked about earlier today as well. It's like it costs a lot of major updates. You
[00:06:02]
can have a record. They're not even really major. That's the thing. That's what's so
[00:06:06]
annoying because they're misleading. It's like you don't actually have to change your
[00:06:10]
code because I make another like thing on the configuration option because it'll be
[00:06:15]
defaulted.
[00:06:16]
Yes.
[00:06:17]
I guess major versions are not a problem because it's very easy to upgrade. But then it's really
[00:06:23]
hard to make an ecosystem around that. Like you can't have any other packages that will
[00:06:28]
target Elm charts because they would have to update all the time.
[00:06:33]
Yeah.
[00:06:34]
That would be very annoying. That's probably the biggest drawback against major versions
[00:06:38]
for this library I think.
[00:06:40]
Yeah. It is pretty annoying. But I've had to accept that it's not perfect from the beginning.
[00:06:49]
Otherwise, I'll just never publish anything. I will try to find a good solution for that
[00:06:55]
because it is a really good point.
[00:06:57]
Yeah. Can you walk us through an example of configuring something? What would be some
[00:07:06]
basic configuration that you might do on a chart?
[00:07:10]
You always start with a chart. It's basically a list of the elements that you like. You
[00:07:16]
would put in like, okay, I want a line chart and then I'll put in the properties of that.
[00:07:23]
What data do you want in there and what access are on that? If data, wouldn't you want the
[00:07:29]
line to reflect and like colors and like dots and stuff? And then you do axes, you can not
[00:07:38]
do axes and you can put labels. I made a big point of like making the axes and all the
[00:07:47]
elements that you can put around it for like navigation of the chart, make them very customizable
[00:07:53]
so you're not locked into like a certain way of doing it. Because sometimes you want to
[00:07:59]
put like labels of like arbitrary elements in your chart. So I've tried to also make
[00:08:06]
the coordinate system available in the charts so that I'm not the only one who like knows
[00:08:12]
how to place things in the SOG world. Because the strange thing about SOGs is that like
[00:08:17]
the coordinate system is not only flipped, but it's also like, you know, it's based on
[00:08:22]
the pixels, but then, okay, if you scale it, it's actually not pixels. It's just very confusing.
[00:08:28]
So I try to make it easy to just like, okay, I want this to be at X equals five and Y equals
[00:08:36]
six and then that's all you need to know. So yeah, I've tried to make it really flexible,
[00:08:43]
but we'll see. We'll see how people find use cases that it doesn't fit.
[00:08:49]
Yeah. What I really like is that it's not like you have a chart and you say, this is
[00:08:53]
a bar chart or this is a pie chart or whatever. It's more like you have a chart, you configure
[00:08:59]
the chart, you say, this is the padding, this is the size. And then you compose, you add
[00:09:06]
elements to it. So you add bar charts, you add lines, you add axis. And what I really
[00:09:13]
like with this system is like you can add multiple axis really easily. And yeah, you
[00:09:20]
just compose, you just add them all together. That's really nice, I think.
[00:09:26]
Thank you. Yeah. That was actually one of the things that was also an issue with the
[00:09:30]
line charts thing. It was kind of constraining as to what elements you'd be able to put in
[00:09:37]
and just how creative you could be with your chart. And I think I was quite enthusiastic
[00:09:44]
about this idea of defaulting to really nice charts or to good charts in a way or as correct
[00:09:52]
charts or whatever. You talked about that in your Coco Chanel talk
[00:10:00]
with Elm Townsend, your Elm Europe talk, I think. Yeah.
[00:10:05]
But I also think it's very difficult to predict what is a good chart in a way. You can put
[00:10:13]
up guidelines, but I think you can't really restrict it in a way. I think I kind of tried
[00:10:20]
to listen to like Evertefte and stuff like that. And you shouldn't put too many elements
[00:10:24]
in your chart and don't use pie charts or whatever. But honestly, I'm sort of turned
[00:10:30]
on that. I'm just like, if you think a pie chart would be the best for your users and
[00:10:35]
make them understand the best, you should do that. And so I don't want to be prescriptive
[00:10:41]
in the library in a way. It's also just fun to do it. And I think also there should be
[00:10:47]
like, you know, maybe it'd be good to have like a second library that sort of like is
[00:10:52]
on top of this where, okay, this is only, this can do like Evertefte charts or whatever.
[00:10:58]
But I want there to be an option where it's just like, okay, you can build whatever you
[00:11:03]
want. So can people build pie charts with Elm charts?
[00:11:07]
No, but I'm planning to add that actually. So yeah, I'm actually quite happy with one,
[00:11:15]
like I think it's very easy to actually add chart, new chart shapes. I don't remember.
[00:11:24]
So I think I'm going to do some releases quite soon. Because one of the tricky things about
[00:11:31]
it is like doing the events because once you have overlapping elements, regular event handlers
[00:11:40]
are not going to cut it. Because then you, if you have like two bubbles, for example,
[00:11:46]
overlapping and you're standing on the overlapping part, like which should it pick? I mean, it
[00:11:50]
should kind of show both of them, or at least you should know that you're hovering over
[00:11:55]
both of them. But that wouldn't, you wouldn't be able to see that as easily just doing regular
[00:11:59]
events on the SVG. So, or like native events. So, but now like I have a pretty good foundation
[00:12:07]
for doing that sort of event stuff. And it's quite easy to like add it, add new charts,
[00:12:13]
types and stuff like that. So I'm excited about that.
[00:12:17]
That's really interesting. Yeah. I think I've spoken a few times on this podcast about my,
[00:12:22]
you know, how much I appreciated this concept of the extensible web manifesto and that like
[00:12:28]
it sort of said, let's, Hey, let's not try to assume that we're going to be able to build
[00:12:33]
for every use case when we're building out the web platform. Like the web platform should
[00:12:38]
be a platform, which means it should, it should have the building blocks to do what you need
[00:12:43]
to with it. And then if people want to abstract those building blocks, the building blocks,
[00:12:50]
their job is to be a solid foundation and extensible in the right ways and not locking
[00:12:56]
you into certain things that you can't back out of. Cause the, like, if the platform doesn't
[00:13:00]
give you the ability to do that, you can't build that on top of it. But if you want to
[00:13:04]
build like a nice happy path with a high level way to consume that, that's can be in user
[00:13:10]
space or, you know, that can exist in another library. So it sounds like you've arrived
[00:13:14]
at a similar like idea with, with the principles for designing this API.
[00:13:19]
Yeah, exactly. I'm a subscriber to that theory. I think at least it's very good to like build
[00:13:27]
those basic, like have those basic building blocks in the ecosystem. And then like if
[00:13:32]
people want to do more descriptive things, then that's great too. I mean, cause I love
[00:13:38]
using prescriptive libraries because there are just like lots of things that I don't
[00:13:41]
know anything about and I, and that's, it's not the object of my tasks to like learn everything
[00:13:47]
about this particular area and I just want it to work. So I think that's where I, like
[00:13:52]
my initial feeling came from. I was like, I just, I just wanted to make a chart. I didn't
[00:13:57]
want it to know so many things. So yeah.
[00:14:01]
That's cool. I actually, I had a similar thought with, with the new Elm pages released that
[00:14:07]
I was like, you know like there used to be this assumption that you put like a markdown
[00:14:13]
file or some file in the content folder and then it creates a page for you. And now it
[00:14:19]
doesn't do that. And if you want it to create a page based on something in markdown folder,
[00:14:23]
you tell it, you tell the framework to do that, which means if that's not how you want
[00:14:27]
to do things, if that's not where you want your pages to come from, you, you can change
[00:14:32]
that if you want like a single markdown file of like slides for a presentation and you
[00:14:37]
want to extract in all of the little break points in that or all the headings in that
[00:14:44]
markdown file and create a page for each of those, for each slide, you can build that.
[00:14:49]
But if someone wanted to build an opinionated thing that's like, I liked it exactly the
[00:14:53]
way it was before, that was exactly what I needed. Great. Then like go build a framework
[00:14:57]
on top of the framework and yeah, but you can never like anticipate every need that
[00:15:04]
a user will have. You know, we were talking to Ryan about that when, when we had him on
[00:15:08]
and he was saying like, I'll never anticipate everything a user will need. So I need to
[00:15:14]
like give them the power to extend things as, as needed. Yeah, yeah, exactly. No, and
[00:15:19]
I think to some extent this is like the progression of the ecosystem. I suppose like you start
[00:15:24]
like, I mean, it's like, like there was JavaScript, you can do the wildest things in that. And
[00:15:29]
then there's Elm is like a little more prescriptive. And then there was like all these like, there's
[00:15:34]
Elm pages comes in and just like, so I think that's really beautiful and a natural progression.
[00:15:39]
And then you can sort of pick the layer that you need to operate within. And then Yeroon
[00:15:44]
will make like, you know, an Elm charts, no pie charts rule with Elm Review. After you
[00:15:51]
add that functionality. That's hilarious. You all make things possible and I make things
[00:15:58]
impossible. You make cool stuff and I make it like, no, this part is not cool. That's
[00:16:08]
hilarious. Yeah. Like, it was just like, okay, you just make it impossible to import pie
[00:16:12]
charts from Elm charts. Yeah. Easy, easy. Just automatically deletes it. Right, exactly.
[00:16:21]
Use my proposed fix. Just a slap on the wrist. So Elm charts slogan or is a composer chart
[00:16:31]
with delights. I'm curious to know what part of the experience do you think is delightful?
[00:16:38]
I know we like to use delightful in all things Elm. Yeah. Yeah. Honestly, I had so much trouble
[00:16:45]
finding a good tagline for it. I was so confused. I went so many ways. We tried to do the original
[00:16:53]
like, we're like, so, like Evan told me the story about how he found the tagline for his
[00:16:58]
thing and like, he was working at Prezi and he was talking to like the marketing manager
[00:17:03]
or some, like some lady that had some sort of marketing role and they did this like classical
[00:17:09]
like chart of like, what features do your library have and like human terms and then
[00:17:14]
you like narrow it down and we did that. But like, I feel like it ended up being like super
[00:17:19]
generic just like, oh, it's like, I just want it to be nice. I want you to be confident
[00:17:24]
with your chart. It's like it always sounded terrible. We're like so generic that it didn't
[00:17:30]
make any sense. You know, there's like some words that I just have a distrust towards
[00:17:35]
because they're just like used in every single library of Saba, like reliable. It was like,
[00:17:41]
oh, it's reliable. It was like 2% of things that says that are reliable or reliable, you
[00:17:46]
know?
[00:17:47]
So you're saying that Elm Chart is not blazingly fast?
[00:17:50]
Well, I mean, I guess it's fast. I mean, it's, well, it's just like the like, my point is
[00:18:01]
just that I didn't know what to put in there. And then I just found that like, you know,
[00:18:06]
I just want you to have a good time making a chart. You know, I just want it to be not
[00:18:12]
a frustrating experience. And actually one of the things that I was thinking a lot about
[00:18:16]
was like, I didn't want it to be cluttered. I think a lot of the time, like when I've
[00:18:21]
been making charts in the past, and like, there's been like a huge, huge lead class
[00:18:27]
before my chart with all these like variables that I've been setting. It just felt like
[00:18:33]
an overwhelming task. And I wanted it to be like, clean and nice. And I wanted to just
[00:18:38]
like, you know, it just like reacts the way you expect it to be, to do. And actually,
[00:18:44]
somebody told me it does that. So I was very excited about that review. I was like, that
[00:18:48]
was the best thing I heard all day. So I think that was a big part of it. I just like making
[00:18:55]
charts can just like be a really difficult experience because like not only are there
[00:19:00]
like, exilient charting libraries to pick between. So like, even like you start up and
[00:19:05]
you're just like confused from the beginning. And then like, there's like such variation
[00:19:10]
of the detail of charts, libraries, you know, like what exactly, like what level are we
[00:19:16]
discussing? Like, or like, are we building out? Like, are we doing raw SVG? Are we doing
[00:19:22]
like a D3 kind of style? But there's like, these are the options. So I just wanted to
[00:19:27]
make something that's like, okay, it's very like descriptive. Okay, like I want a chart,
[00:19:32]
and it should have an axis in it. And it should have a line. And it should have a bar chart.
[00:19:39]
And that's it, you know, like,
[00:19:41]
and adding a tool to like, in the section on interactivity. And you know, you've got
[00:19:46]
ways to add tool tips, like, it must be doing a lot under the hood, because tool tips aren't
[00:19:52]
like a native concept, like in SVG or in in the browser, really. So and that's one thing,
[00:19:58]
like in in Elm that can sometimes be challenging is you're like, you can't just sprinkle in
[00:20:04]
this JavaScript that magically like makes tool tips appear places. But this tool tip
[00:20:09]
API looks really intuitive.
[00:20:10]
Yeah, I'm so glad to hear. Yeah, that's actually one of the things that took me the longest
[00:20:16]
time for sure. Like, honestly, like, drawing things on an SVG is not actually that difficult
[00:20:22]
is like, draw a rectangle, draw a circle. Right. But designing the events API was like
[00:20:29]
really, was probably that was the most challenging part of the API. And it's still definitely
[00:20:36]
like, even though it's like, you say it looks, it's quite intuitive. And I think that's been
[00:20:41]
a long process. And definitely wasn't in the beginning. And it's still, I think, one of
[00:20:47]
the most complicated parts, if not the most complicated parts of the library, even though
[00:20:52]
I've tried to make it as simple, but it's just like, you have to be able to do a lot
[00:20:56]
of things. So like, for example, like, if you want to hover not only just like this
[00:21:01]
dot, but like, maybe you want to hover a stack, and it should react like on on all like hovering
[00:21:07]
any part of the stack and not just like one of the elements. And so and like, maybe you
[00:21:12]
wanted to find the nearest stack. And so there's just like, so many things you could want from
[00:21:20]
an interactive and from an interactivity. So yeah,
[00:21:24]
I, okay, here's, here's a thing I want to do with it really more of a graph than a chart.
[00:21:31]
And I'm curious if if this would be like an Elm charts thing, or if this would maybe be
[00:21:36]
like an Elm visualization thing more, I want to have like a, like interconnected nodes
[00:21:43]
in a graph with basically arrows of basically for my like digital garden of like, this note,
[00:21:51]
like 10 different nodes point to this note, and then interconnected nodes with like arrows
[00:21:55]
pointing
[00:21:56]
Oh, yeah, so I wouldn't say that's like that. I don't have like native support for that
[00:22:01]
right now. But I'm trying to even though you could technically there's actually like a
[00:22:05]
custom thing. So you can like make any shape you like, and they will hook into the interactivity.
[00:22:12]
So right, I've sort of hidden this because like, I don't is not like a very developed
[00:22:17]
API. But there's a heat map example on the site of like, you can make a heat map with
[00:22:23]
this custom thing. So you could use that to make the graph if you really want to, but
[00:22:29]
it's not like a poof, it's just there.
[00:22:32]
Right, right, right. Yeah, right. So, so it's, I guess, like Elm visualization has some sort
[00:22:43]
of broader things. It's a visualization library, and this is more of a charting library. So
[00:22:48]
that would you say that's the distinction?
[00:22:51]
Well, I think like, Elm visualization, I haven't used it a ton. But my impression is that it's
[00:22:57]
a lot broader. And like, it also just like works on SVG, like you just make SVG elements,
[00:23:04]
as far as I know. And so it's a lot more low level, essentially. So I wouldn't say that
[00:23:11]
like, I think the I'm trying to do things high level more. And that also means that
[00:23:16]
like features will come a little slower. So for example, like the chart, the graphing
[00:23:21]
thing that you just mentioned, like I could definitely make that but I'd have to make
[00:23:25]
it so that would delay it a bit. But yeah, right.
[00:23:29]
It's not like Elm charts isn't aiming to be D3 level of customizability necessarily.
[00:23:35]
Yeah, yeah.
[00:23:36]
But that is Elm visualizations aim, is it?
[00:23:40]
Maybe. I think it's inspired by D3 and has adopted a lot of the similar like concepts.
[00:23:50]
So I think it does have like aspects of that at least. But at the top of the docs, it says
[00:23:57]
this project is designed to give you all the tools needed to build data visualizations
[00:24:02]
is not a charting library in the sense that you have pre bundled Excel style charts, but
[00:24:08]
should contain all the tools to make building such charts relatively easy. The advantage
[00:24:12]
is that you are free to design and build data visualizations that uniquely suit your needs.
[00:24:16]
So yeah, I think that's a pretty good split between the two.
[00:24:20]
Yeah, yeah, I guess. Yeah, yeah, I'm never I've never really been sure what the exact
[00:24:27]
definition of a chart is. But I guess I guess this is a charting library in that case. Yeah.
[00:24:34]
But yeah, I think ultimately, my hope is that somebody who needs like, basic charts, like
[00:24:41]
charts that we all know about generally like lines, bars, pies, heat maps, like that sort
[00:24:49]
of thing, you should be able to make in the charts eventually. And but of course, there's
[00:24:56]
definitely like, like, it's not like trying to replace language visualization at all.
[00:25:01]
Like I think that's a great tool. And it's so flexible. And you should definitely be
[00:25:07]
there.
[00:25:08]
Yeah. So so have you thought about making charts be a higher API of of Elm visualization?
[00:25:17]
Or was it similar to build upon?
[00:25:20]
Yeah, actually, like, so I think I don't, I'm not exactly sure of the history. But I
[00:25:25]
think I had like my foundations for building srd charts, like pretty early on as well,
[00:25:31]
at least before I knew about Elm visualization. So I didn't really need it in a way, because
[00:25:37]
I already had built that stuff myself. So yeah, I don't Yeah, I think one of the things
[00:25:44]
is that I don't I haven't actually used Elm visualization for my own stuff. So we're like
[00:25:49]
for work or anything. So I think that's maybe also just like thought it'd be fun to understand
[00:25:56]
like the foundations of it. I think that's actually helpful when you're building a library
[00:26:00]
to like know the how everything's built from scratch and have that flexibility. So yeah,
[00:26:07]
I mean, it could, it could have been built on Elm visualization, I'm sure.
[00:26:11]
Well, we're on the topic of other libraries, would you be able to tell what the difference
[00:26:15]
is with Elm Vega?
[00:26:16]
Well, I think the major difference is that it's Vega is a is a configuration library
[00:26:23]
for JavaScript library, isn't it?
[00:26:26]
As far as I can tell, yeah.
[00:26:28]
Yeah. Yeah. So I think, I mean, I think I just like the simplicity of just like, okay,
[00:26:33]
build a chart in sg. And you don't have to hook it up anywhere. But yeah, I haven't like,
[00:26:39]
I haven't actually gone into details of Vega, the Vega library either. So I can't, I can't
[00:26:46]
really specify it. Yeah.
[00:26:48]
Yeah. I mean, once you once you have, you start building on top of something and at
[00:26:53]
a certain point, like I think I think I heard Evan speaking once about maybe considering
[00:27:00]
like trying wasn't there something about Haskell? Has, like Haskell JS or something like that?
[00:27:08]
Oh, yeah, like GHC, GHC, GHC, right. Yeah. And like, at a certain point, he realized
[00:27:17]
like, I can't, I'm going to be so limited by this, that the those little customization
[00:27:22]
points that I need aren't going to be there, because that's not what it's designed for.
[00:27:26]
And yeah, so yeah, I think that's been one of my fears is that like, if you don't know
[00:27:31]
a library really, really well, and you want to do the amount of customizations of the
[00:27:36]
library that like that I wanted to build, then right, I didn't want to run into like
[00:27:41]
a blocker or something. Right. Even if the user station looks like a huge and can like
[00:27:47]
manage like all kinds of scenarios. Right. And I mean, at least for me as a front end
[00:27:53]
developer, but who sort of is not that confident with like the really visual stuff. Ironically,
[00:28:01]
right? It's like, kind of a funny space of being like, I guess, like, sometimes people
[00:28:07]
call it like the back of the front end, you know? I think a lot of Elm people fall into
[00:28:14]
this category that they're more comfortable on the back of the front end. And things like,
[00:28:19]
like SVG, and like really, you know, sophisticated, like CSS animations and things like that seem
[00:28:26]
intimidating. But really, like SVG is like, like you said, like you're telling it, draw
[00:28:31]
a rectangle here. And like, yeah, we don't really, like, we don't really manually want
[00:28:36]
to do that. But it's like, you know, adding those building blocks in your library, you
[00:28:42]
don't really need to build on anything, you could just put a rectangle down.
[00:28:46]
Yeah, I think that was so what was so shocking when I first like started doing the library
[00:28:51]
was actually like how easy it was to actually draw a chart. Yeah. Because I've been so scared
[00:28:57]
of it. Because I was like, Oh, I don't know about this SVG stuff. Because I wrote it,
[00:29:02]
I've always used libraries for it. So it was definitely like, yeah, it was quite a surprise
[00:29:09]
to see like, okay, it's actually like pretty basic. And like the core of this library is
[00:29:14]
really simple, like a whole library isn't very big, really. So it was, I think, drawing
[00:29:19]
it has never been a problem. It's like the biggest challenge has been making the API
[00:29:25]
so that it's easy to interact with while having the breadth of people's use cases.
[00:29:32]
So I played a bit with Elm charts over the last few weeks. And the thing that I found
[00:29:37]
most difficult was to know what can I what operations can I use? Like I'm making a bar
[00:29:44]
chart, how can I configure this bar chart? What functions are available? I think I tried
[00:29:49]
to put that in the documentation in the API documentation. And but maybe maybe that hasn't
[00:29:56]
been sufficient. And I think that's also I mean, I kind of had a feeling that this would
[00:30:02]
be an issue generally because of the way the API is set up, which is also why I made all
[00:30:09]
those examples so that you should have a visual understanding of like how to make something.
[00:30:15]
Because I also think like, one of the things in charting world is that there is not necessarily
[00:30:21]
like a set vocabulary for everything. So I've just like, opted like for just like, okay,
[00:30:28]
like which one of these charts would you like? And then like, you can press on it and say,
[00:30:33]
okay, this is how you do it.
[00:30:36]
The examples are very helpful. And the terminology that you put at the top of the bar chart documentation
[00:30:42]
is also really, really useful.
[00:30:44]
I'm so glad to hear. Yeah, but I think as we as we discussed this morning as well about
[00:30:49]
this question about like, a small fix could be to like put the configuration directly
[00:30:56]
in the bar type instead of having it be opaque. So that would I will just do that.
[00:31:03]
Yeah, I'll try to come up with something but yeah, we'll see how that goes.
[00:31:09]
It's kind of a yeah, it's a little bit tricky to make it just right. But I think like, yeah,
[00:31:15]
lots of trade offs. Yeah, exactly.
[00:31:18]
I think that, well, I've shared my hot take on GitHub Copilot on Twitter, but I feel like
[00:31:25]
basically what I like GitHub Copilot I feel like is trying to do is it's trying to say
[00:31:29]
like, hey, here's like, let me use machine learning to figure out how to suggest something
[00:31:36]
useful to you. And I'm like, no, that's the wrong direction. Like machines are really
[00:31:41]
good at like, being proof engines that can say, all right, I've, I've cranked all the
[00:31:47]
details. And I know that these are exactly the three options that you can use here. And
[00:31:52]
yeah, that's what I want. And that's, I mean, an Elm gives us that in the sense that the
[00:31:58]
compiler can tell us is this valid or not, and you can, it's very statically analyzable.
[00:32:03]
But our tools haven't caught up to that yet to leverage that to narrowly, you know, narrow
[00:32:09]
down our options. And that's the developer experience I want. And I think that all of
[00:32:14]
the libraries in the Elm ecosystem will benefit from that when we when we get that sort of
[00:32:19]
tooling to, you know, for our tooling to be able to say, you know, for configuring your
[00:32:24]
bar chart, like, these are the only things you can do given these types. Yeah, exactly.
[00:32:28]
No, that would be amazing. So you want an Elm review copilot? That would be so cool.
[00:32:36]
If you want to build it, then absolutely. That's something that helps you write things.
[00:32:44]
It's something that tells you, hey, this is not good.
[00:32:49]
Think of how hot Elm copilot would be on Hacker News. People would be all about it. It's true.
[00:32:57]
It'd be so good. It'd be able to do so much, you know, it'd be crazy. The static versus
[00:33:03]
dynamic wars between machine learning. Yeah, I think I think that's just like so as such
[00:33:12]
a bright future to look forward to. It's amazing, because there's just like so many things one
[00:33:17]
could do because there's so much information available. This is going to be very exciting.
[00:33:23]
Yeah, yeah, it seems it seems like the innovation in the Elm ecosystem right now is kind of
[00:33:28]
ramping up. Yeah, I'm also so excited to like, I'm kind of interested in doing more like
[00:33:34]
editor stuff. I think that would be really cool. There's just like, there's so much one
[00:33:40]
could do. Yes. So yeah, we'll see about that. Unfortunately, I don't know anything about
[00:33:46]
editors. And which editors do you want to support? They're not very compatible, unfortunately.
[00:33:55]
Yeah, exactly. Yeah, I've been messing around with the try page yesterday, today. I'm just
[00:34:02]
like updating the styles. And then I'm like, Oh, what if I like make the error messages
[00:34:07]
so you can just like use the suggestions and the error messages by just clicking on it
[00:34:12]
and stuff like that. So I've been very excited about all the what you can do there. And yeah,
[00:34:18]
I'm just like, Oh, should I put Elm review in there so you can get the experience of
[00:34:22]
that as well. I was like, really, definitely like pulling it out of scope and I should
[00:34:28]
just...
[00:34:29]
No, no, it's not out of scope. It's perfect. It's perfect. The only question is like, what
[00:34:38]
rules do you then add? Yeah, exactly. This is a lot of questions. But I think it'd be
[00:34:44]
really fun actually to add it because one of the things that I do think would be really
[00:34:48]
cool to do with Elm is just like what I think is missing is like that people get to actually
[00:34:55]
experience what it's like to work with Elm from just like you go somewhere and you get
[00:35:01]
the experience of working on a large project with all these Elm tools. Because I think
[00:35:07]
that's where it really shines. It's like when you have a tiny example, it's just like you
[00:35:11]
kind of can have it all in your head. So like the types are like, they're cool, but like
[00:35:17]
they're not like saving you the way that they are in huge projects. Look at how maintainable
[00:35:23]
my counter app is. Yeah, exactly. Exactly. So I think that would be cool to like showcase
[00:35:31]
more. So that's one of my what I've been thinking about as well. It's like I think I was with
[00:35:37]
since I've since I quit at Nord Inc. and I've been doing more like community work. I've
[00:35:44]
sort of had a lot on my mind as well like the whole PR world of Elm and stuff like that.
[00:35:50]
So like public relations, like just like how do you present Elm in the most like appealing
[00:35:58]
way or like so people understand what it's about in the best way? Just say it's delightful.
[00:36:03]
Yeah. Yeah, that covers it. The new elmlang.org definitely like presents a nice, you know,
[00:36:12]
image and like it does a good job like presenting it. It was definitely a nice nice overhaul.
[00:36:17]
Yeah. Yeah. Yeah. On that note, what is the official color of Elm? Because it used to
[00:36:26]
be green in my mind. Is it blue now? I think it is blue. I think that's a that's like the
[00:36:34]
that's what we're landing on over time. I think there's still like so I just I've made
[00:36:39]
the for the tri page I was making the theme for the light in the dark and I sort of like
[00:36:46]
okay we're gonna do the blue but I needed more color so I was like okay well I think
[00:36:50]
the orange still makes sense like it's good like as an accent color and then maybe like
[00:36:55]
a pink of some sort I think those colors go rather well together but I think Evan has
[00:37:00]
sort of like left the visual design just to me like I'm just like in charge. I think that's
[00:37:06]
a good choice. Judging by the Elm charts website which is absolutely gorgeous. Thank you. Yeah,
[00:37:16]
it's like you look at those charts and you're like how do you make charts look so pretty
[00:37:21]
like all these little like details like what makes these charts look so pretty it's like
[00:37:27]
some opacity and like some rounding on the bar charts and some rounding on the lines
[00:37:33]
and like it's so cool. Thank you. What are your secrets? You know actually Evan has asked
[00:37:40]
me that question before too as well and I like can't tell I think this is like building
[00:37:46]
like I just I've seen so many mocks and tried to build them and I think like I remember
[00:37:51]
in the beginning like we had a designer like I was working on a consultancy and the designer
[00:37:56]
would give us these mocks and then I'd make it and then I'd be like wait why is the designer's
[00:38:00]
mug so beautiful and my page is so ugly and I just couldn't I didn't understand what was
[00:38:09]
happening but I think it's all about my theory it's all about margins like margins and colors
[00:38:15]
like just like get the colors right to be soft enough to go with each other and just
[00:38:20]
like have the margins be correct but yeah I can't pin it down any further. Well the
[00:38:27]
margins are important that's for sure. Yeah yeah or just like have it be like harmonious
[00:38:33]
like a what's it called like a color scheme. Yeah yeah yeah but it's really difficult really
[00:38:41]
to pin down honestly I feel like I just mostly I just wing it I think it's just an intuition.
[00:38:48]
So basically if you want a beautiful chart just go through the account charts documentation
[00:38:55]
pick one chart and you're good to go. Absolutely. Or you can hire me to make you your chart
[00:39:00]
and I'll make it for you. That's the only way to get your intuition yeah. When I look
[00:39:07]
at these charts I and compare it in my mind to what what super ugly chart I would like
[00:39:14]
intuitively do if I just built a chart like the bar charts would not be rounded there's
[00:39:20]
like a nice little rounding at the top like you've even got these like bar charts that
[00:39:25]
are like rounded on both ends and they don't even have like a label on the bottom which
[00:39:30]
looks so nice and then like the lines are not just jagged lines they're like rounded
[00:39:40]
a little bit so things have like a little more rounding things have like a little more
[00:39:43]
opacity like everything has a little bit of opacity and a lot of things have like a little
[00:39:49]
bit of a gradient like none of the colors are like bold you know none of the colors
[00:39:55]
are colors that you could write by just writing a word in CSS yeah like red or black or blue
[00:40:04]
yeah exactly I think that those are all differences between what I would build and what you have
[00:40:09]
on the landing page so those are probably good design tips just like do a diff between
[00:40:15]
what I would do and what you did that's funny there you go design school now I'm very curious
[00:40:20]
to know what what colors are in your charts um if it's not red or if it's not purple it's
[00:40:28]
probably some hex code and yeah no it definitely is I actually spend so much time trying to
[00:40:34]
pick the right colors it's a very challenging space for me because you sort of need color
[00:40:39]
with enough contrast to each other while like still keeping them nice so you have to find
[00:40:45]
like a nice hue of things that are still because my my personal style is just like I like no
[00:40:52]
I was just basically no colors they're just like it just like white things maybe a little
[00:40:56]
green like if you look at my apartment has like three colors in it um it was like very
[00:41:01]
peaceful but I couldn't do you can't do that with a charts library you just have to have
[00:41:04]
colors I mean you can do it but it shouldn't be the default like if you want accessibility
[00:41:09]
you probably shouldn't do it at all so I spend a lot of time trying to find some colors that
[00:41:14]
like fit in nicely I think so yeah I hope hopefully I was successful I actually I almost
[00:41:22]
like pivoted into using the google colors like from the google color scheme but Evan
[00:41:28]
convinced me to go with my intuition which is very it was very helpful but yeah so how
[00:41:36]
do people get started with using Elm charts well I think all you really need to do is
[00:41:42]
just to install tereska slash Elm charts and import the chart module and from there like
[00:41:52]
if you're not going to do any customizations you can sort of leave it at that and just
[00:41:56]
say charts and just like do the basic like okay I want to axis I want to bars bars and
[00:42:02]
for a line or whatever but actually probably what I would really recommend and what I think
[00:42:07]
everybody does is just to copy one of the examples yeah yeah which is why that's so
[00:42:13]
important because that's just that's how people use things yeah yeah exactly yeah I think
[00:42:18]
also like what I've experienced he's about past two weeks I guess since I've published
[00:42:22]
it is that like people barely people don't even read the documentation from the api anymore
[00:42:28]
they just look at examples if it's not in one of the examples people don't think is
[00:42:31]
there so at this scenario where somebody was like oh like can I rotate a label and like
[00:42:38]
you can it's there's an attribute called rotate but I had forgotten to make an example for
[00:42:44]
it so they were just like wouldn't it be nice if you could rotate that thing and I was like
[00:42:48]
yeah I mean you can but I was like okay I'll just I'll just add I'll add the example you
[00:42:55]
know I mean you made the example so good that you get people excited yeah once you try it
[00:43:01]
out and then like the documentation yeah I think also like I mean I don't I don't mind
[00:43:08]
it actually I think it is especially for charts I think it is so to me at least a nicer way
[00:43:14]
to learn because you just you know what you want visually and then you can just go find
[00:43:20]
that so I think that was like I want people to use the examples and I do plan to just
[00:43:26]
make an example for like every single thing you could do basically that would be very
[00:43:32]
cool yeah yeah I think I'm already like fairly close to it obviously I can't do combinations
[00:43:38]
but because that would be an insane idea but yeah so basically if we yeah like you've you've
[00:43:47]
got all these like built in colors and things and if we if we do that then are we can gain
[00:43:54]
a little bit of your design intuition right yeah you've like built a little bit of it
[00:43:58]
into some of the defaults yeah I've definitely tried to make the default chart that you build
[00:44:04]
fairly nice that's I really like that because I mean I don't know if something gives you
[00:44:10]
the tools to like make something look nice but it's sort of like yeah you can make something
[00:44:15]
look nice if you like try really hard yeah yeah exactly that's not a good experience
[00:44:22]
because it's finished it's not gonna look nice yeah yeah I think there's also there's
[00:44:26]
there's like two different user groups who'd end up using this charting library and like
[00:44:33]
one of them is like just like developers like you and I who are like doing home projects
[00:44:38]
or like side projects and either charge to visualize some data that we collected and
[00:44:43]
so there's no designer on the project but then there's like the other side where it's
[00:44:47]
like like I was building this originally for it was like a consultant consultancy job where
[00:44:54]
there was designs and you knew these charts and stuff like that so it needed to be like
[00:44:57]
very specifically looking this way and so you sort of need to it can't just be the default
[00:45:04]
pretty you need to customize everything through like to a very high level which is one of
[00:45:10]
the wilder things to do is just like you need to be able to round everything and like because
[00:45:16]
I've never thought of actually like rounding the bottom of the bar chart but I just realized
[00:45:22]
that that's people need that some people need that in their design so you just need to make
[00:45:27]
that an option yeah some people really need it like this chart is totally not gonna work
[00:45:34]
if the buttons aren't rounded exactly exactly and it's it's actually funny because like
[00:45:40]
you could do some like fairly irresponsible charts using the feature where it's like rounding
[00:45:46]
it too crazy I don't know you can do some visually tricks like where you make your bar
[00:45:51]
like because there's all these like interplay between volume and position so like if you
[00:45:57]
have the rounding like it might look smaller than it actually is and like just like tricks
[00:46:03]
on your brain some opacity yeah yeah exactly so you can like highlight certain things right
[00:46:10]
yeah make your competitors product in an ugly color yeah could you customize the bar to
[00:46:18]
be like a squiggly line like a snake that'd be hilarious I mean technically you can you
[00:46:27]
could make that if with the customs yes and you can still hook into the events thing so
[00:46:33]
it's you could do it but it's definitely not recommendable but yeah so we briefly mentioned
[00:46:43]
the like events API but can you can you walk us through in a little more detail like so
[00:46:50]
you can you can get like nearby elements with these events and then interact with them like
[00:46:56]
what what does that look like yeah so I guess like a basic the most basic interaction you
[00:47:02]
could do on a chart the classic one is like okay if you hover over a certain element then
[00:47:09]
you could show tooltip or whatever or like you can register that you're over that element
[00:47:14]
but then there's also like okay like do you want to okay how about you want to know if
[00:47:20]
you're within 10 pixels away from that element and that's where it starts getting tricky
[00:47:25]
or you could do like okay I want the nearest element to where my cursor is so that's the
[00:47:32]
sort of stuff that it makes easy to do and like especially also then like when you start
[00:47:38]
working with groups of elements like I alluded to earlier like what if you're not only looking
[00:47:43]
for a single bar but also like a group of bars or a whole like bin of bars so you can
[00:47:51]
do like a really high level of customizations as to what elements you're looking for on
[00:47:57]
your chart based on your cursor position yeah right and then you can get messages from those
[00:48:05]
events so you can update your model however you need to to present information yeah so
[00:48:10]
that's actually one of the things that I've been that I've tried very hard to make possible
[00:48:16]
is that like so that you know everything about the thing that you're hovering so like what
[00:48:21]
color it is what the exact position of it is what data it came from like so that you
[00:48:29]
can have like very advanced tooltips and you can use that information other parts and like
[00:48:35]
so it doesn't only belong to the chart but you can if you have a table below you can
[00:48:38]
also use that information in your table so yeah that's been a big part of making the
[00:48:47]
events api's like me picking all that information available to you as well and on
[00:48:51]
those events are just regular elm events yeah yeah so you can have when you click on a bar
[00:48:58]
you can have open a new page you can do whatever so that's very cool yeah yeah there's actually
[00:49:06]
yeah technically there's nothing fancy about it it just like it's all about like collecting
[00:49:12]
the information and giving it a nice format which has been tricky to find out exactly
[00:49:18]
what that format should be yeah i really like that attributes design and so the the events
[00:49:24]
like like we're familiar with with like on click handlers and elm it's uh it's just an
[00:49:31]
attribute and yeah it feels really natural thank you i'm so glad to hear that yeah i
[00:49:37]
don't think i've seen that really in a lot of places as configuration it's really interesting
[00:49:43]
yeah i think i don't remember the exact history in the past either but i think that's been
[00:49:49]
a big part of where you'd sort of like run into trouble with a lot of the libraries that
[00:49:54]
i've been using for example from the rack world i mean it's a long time ago since i've
[00:49:58]
used them so i don't know if they've improved um but like doing more advanced interactivity
[00:50:03]
like this so like find the nearest thing find groups of these things and then like just
[00:50:08]
like have it not be complicated or just like a one liner and yeah so i really tried to
[00:50:15]
make that experience as uncomplicated and intuitive as possible right yeah right because
[00:50:22]
there's you have to build those concepts as first class citizens to to expose them there's
[00:50:27]
no sense of like nearest things it's just yeah exactly rectangles on a exactly yeah
[00:50:36]
i think maybe that's now that we were talking about taglines earlier i think maybe one of
[00:50:41]
the things i've also wanted to put in there which ended up being just a header was like
[00:50:46]
this idea of like intuitiveness and this declarativeness i just want you to like describe what chart
[00:50:53]
you want like i wanted to when you like when you must move i wanted to find the nearest
[00:50:58]
element and then i wanted to have these elements and like have it be also like so you look
[00:51:03]
at your code and it's like visually like it explains what your chart is so that's what
[00:51:10]
i've sort of been my inspiration and goal yeah i mean just reading through an example
[00:51:16]
it's very clear what everything will do that is very nice that makes me so happy to hear
[00:51:22]
we have um at work we use vega and we have vega specifications which are hundreds of
[00:51:29]
kinds of codes and there's a lot of computation in there and a lot of properties that are
[00:51:36]
probably not well set yeah this is jason yeah i'm hoping it doesn't it isn't but you never
[00:51:43]
know yeah and it is really hard to to figure out how to do some things yeah and i never
[00:51:51]
even got to the part where we do events yeah i mean i'd be curious what kind of requirements
[00:51:58]
you have for your charts and stuff like that and hear more about it so that could convince
[00:52:03]
you to use elm charts so are there any other resources you'd recommend for people getting
[00:52:10]
started is it i mean the the basically elm charts.org and then never look at the documentation
[00:52:16]
site is that what you'd recommend yeah yeah i actually i think that would be the way to
[00:52:20]
go definitely like utilize um the examples that are there and they should cover almost
[00:52:29]
everything and yeah i mean you could resort to the api documentation if you really need
[00:52:36]
to but yeah i think most people have actually made it really far um just looking at the
[00:52:42]
examples and now if people go back and and watch your your talks that you've given about
[00:52:49]
like these charting ideas is it is it basically going to be like the like you've changed your
[00:52:55]
thinking so much that it's history at this point right it's not i think it is like your
[00:53:01]
your prescriptive chart idea you've sort of done a 180 on that yeah yeah i mean i think
[00:53:08]
like to some extent like as we also discussed i think prescriptive libraries would be nice
[00:53:12]
to have but i think there was um as i've become more like uh like i feel responsible for like
[00:53:22]
the elm community like ecosystem in a way and my goal as like through my consulting
[00:53:27]
as well is just to like fill out those holes and like make it as nice experience as possible
[00:53:33]
so that's why i wanted this library to be more flexible because i wanted to cover a
[00:53:39]
larger breadth of people and use cases and just like yeah and so i think like if somebody
[00:53:46]
wants to make a prescriptive library like that'd be great i love those as well so i
[00:53:51]
think just yeah like there should be a library that could cover the a larger um set of use
[00:53:57]
cases and pie charts just to be clear a prescriptive library would only allow a few things is that
[00:54:04]
yeah or like just to make um yeah like make things yeah for example like not do pie charts
[00:54:11]
or uh make axes in a certain ways like if you read ever tough these books like he has
[00:54:17]
a lot of opinions about what you should and should not do which i think they're really
[00:54:23]
great and they're really good to know and they do makes for some really beautiful charts
[00:54:29]
but i think no no shade to edward but i think there's also use cases for the things that
[00:54:36]
he's dis recommending so yeah i think it's also it's fun to be creative with visualizations
[00:54:45]
like it's it's like you're describing your data and your data might be really unique
[00:54:51]
and it might be like you might even come up with new ideas for how to present yourself
[00:54:56]
and you could be the new edward tufty out there even i mean sometimes you do need those
[00:55:03]
snakes yeah yeah exactly like maybe there was a really intuitive some data that really
[00:55:09]
needs snaky bars like who knows we just we just don't know what's out there maybe you're
[00:55:16]
showing like sales at a pie company exactly you really need a pie chart yeah if nothing
[00:55:24]
else it'd be good for jokes you know and i think that's an important as like this important
[00:55:30]
to have in the ecosystem as well definitely so yeah well thanks so much for for joining
[00:55:38]
us to talk about your your new library teresa and congratulations on the release thanks
[00:55:44]
thanks for having me and congratulations on your release thank you well uh it's uh it's
[00:55:50]
several weeks ago uh people listening now but that's okay we snuck in our our episode
[00:55:58]
release on the same day so i'm happy about that that's good well thank you so much for
[00:56:02]
having me on it was so much fun and i really enjoyed our conversation our pleasure yeah
[00:56:07]
you're welcome back anytime thanks and you're in until next time until next time