🏠 back to Observable

Line Break Multi-Line Observable Plot


I am trying to use the new Observable Plot library. So far I love how easy it is to use, but I have run into a problem. I need to implement a line break in my multi-line chart but I have no undefined or null data between the two points. In Mike’s line mark example, it seems that the only way to have a gap in the line is if you introduce undefined data points? Is there a workaround if you don’t have missing data (there was a survey question change between 1992-1993 that caused a huge drop in estimates).

Here is my notebook:

Thanks for your time!

You can do this by tweaking the definition of the z channel such that before and after 1993 are considered separate series. For example:

z: d => [d.grade, d.year.getUTCFullYear() < 1993].join()

That looks something like this:


Thank you so much. I see that with this method I can introduce multiple line breaks. This is perfect! Much appreciated.

1 Like