Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Series are plotted outside of plot area for values outside of low/high

See original GitHub issue

In many applications data that is to be plotted includes points that are outside of the plotting region of the chart. For example, one might want to show the graph of a mathematical function like f(x) = x^3 over the interval x = [-5, 5]. The minimum and maximum y values for this case would be f(-5) = -125 and f(5) = 125, but we might want to have a 1:1 aspect ratio (showing y values on the interval y = [-5, 5]) or otherwise “zoom in” on different parts of the graph. However, if one attempts to do this in Chartist right now it seems to continue drawing the series outside of the area where it belongs.

To demonstrate the problem, here is a very simple case based on the “Simple Line Chart” example where the low: 5 option has been specified. As you can see the second and third series both draw over the label area where their values are less than 5.,js,output

In my application I added a quick hack to work around this wherein I modified the projectValue function so that if the result is negative it is set to zero instead. However, this has the unfortunate side effect that it shows an incorrect value on the chart (the value isn’t really zero). I tried using a value like undefined or NaN but this seemed to cause other problems (SVG line element got invalid length attribute or something like that).

It would be great if Chartist would “clip” the series to the plot area so that values outside of it are not shown.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

jacobqcommented, Jun 8, 2018

@mkosichek Thanks for your effort. However, I opened this issue more than 1 year ago and am actually no longer using Chartist (plotly.js was a better fit for my use cases), so I’m going to close this.

damianprzygodzkicommented, Apr 4, 2018


Read more comments on GitHub >

github_iconTop Results From Across the Web

Clip lines to plot area and display text outside plot area
I want to restrict the visible y-range of my plot. In order to retain values that fall outside this range I need to...
Read more >
Incorrect color assignment for grouped variables. · Issue #3630
In the center plot where a=2, the sloped line should be black and the flat line ... b = repeat(["low","high"], inner=2, outer=3), c...
Read more >
ggpubr: 'ggplot2' Based Publication Ready Plots - R Packages
The 'ggpubr' package provides some easy-to-use functions for creating and customizing 'ggplot2'- based publication ready plots. Find out more at ...
Read more >
Visualizing Data in Python Using plt.scatter()
Customize scatter plots for basic and more advanced plots; Represent more than two dimensions on a scatter plot. To get the most out...
Read more >
Package 'ggplot2'
uses that character as the plotting symbol), a . to draw the smallest ... outside those limits, then those data points may show...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found