# Help with update function (mutable var)

**URL:** <https://talk.observablehq.com/t/help-with-update-function-mutable-var/3598>\
**Category:** Uncategorized\
**Created:** [July 13, 2020, 2:52pm UTC](https://talk.observablehq.com/t/help-with-update-function-mutable-var/3598 "2020-07-13T14:52:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ricardopss](https://avatars.discourse-cdn.com/v4/letter/r/85e7bf/32.png) [@ricardopss](https://talk.observablehq.com/u/ricardopss)\
**Post date:** [July 13, 2020, 2:52pm UTC](https://talk.observablehq.com/t/help-with-update-function-mutable-var/3598/1 "2020-07-13T14:52:32Z")

</div>

Hello, newbie here.

I was visiting the d3.bisect function and I am a hard time trying to replicate the line chart here: [https://observablehq.com/@ricardopss/d3-bisect](https://observablehq.com/@ricardopss/d3-bisect).

I don’t know why but the chart’s legend and markers are not updating, though the bars and the mutable lookup cell value are updating with mouse move.

At first, I thought it was due to different data formats, but apparently no. I am almost certain that the problem is somewhere inside the update function, but again, I couldn’t figure it out.

Anyone could give me a hint?

---

<div class="post-metadata">

**Author:** ![ricardopss](https://avatars.discourse-cdn.com/v4/letter/r/85e7bf/32.png) [@ricardopss](https://talk.observablehq.com/u/ricardopss)\
**Post date:** [July 14, 2020, 1:03am UTC](https://talk.observablehq.com/t/help-with-update-function-mutable-var/3598/2 "2020-07-14T01:03:29Z")

</div>

I have just figured it out: d3.bisect works only with sorted data!

🕶
