Company logo
  • Empleos
  • Bootcamp
  • Acerca de nosotros
  • Para profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
    • Bootcamp
  • Para empresas
    • Inicio
    • Nuestro proceso
    • Planes
    • Pruebas
    • Nómina
    • Blog
    • Calculadora

0

67
Vistas
Chart JS - Add Interpolation points in order to highlight a segment

Background - I'm trying to highlight a Segment of points (via the segment.backgroundColor API) that are not necessarily a part of the graph. if my data is

const data = [{ x: 1, y: 1}, {x: 3, y: 1}, {x: 5, y: 1}] 

I'd like to highlight the segment between x == 2 and x == 4

To do this, I assume it'd be best to manually add {x: 2 y: 1} and {x: 4, y: 1} to the graph.

The problem - I don't know the y values x==2 and x==4 will need to have on the actual graph

My Question - Is there a way to ask charts.js to automatically derive the y values? either through config or the data points themselves, something like:

// NOT ACTUAL CODE
const data = [
  {x: 1, y: 1},
  {x: 3, y: 1},
  {x: 5, y: 1},
  {x: 4 y: 'auto/interpolate'},
  {x: 2, y: 'auto/interpolate'}]
// NOT ACTUAL CODE

or

const datasets =
 [{ data, autoInterpolateMissingPoints: true }] //NOT ACTUAL CODE
7 months ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar empleo Planes Nuestro proceso Comercial
Legal
Términos y condiciones Política de privacidad
© 2023 PeakU Inc. All Rights Reserved.