# vtkcharxy with rectangles

**URL:** https://discourse.vtk.org/t/vtkcharxy-with-rectangles/11026
**Category:** Support
**Created:** [March 23, 2023, 12:46am UTC](https://discourse.vtk.org/t/vtkcharxy-with-rectangles/11026 "2023-03-23T00:46:55Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![antoine1](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/a/73ab20/32.png) [@antoine1](https://discourse.vtk.org/u/antoine1)
#### Post date: [March 23, 2023, 12:46am UTC](https://discourse.vtk.org/t/vtkcharxy-with-rectangles/11026/1 "2023-03-23T00:46:55Z")

</div>

Hello,

I have a plot on vtkcharXY and i have a qslider (from qt).  
the slider is a double slider ( or a range slider).

The idea is the user can set the double slider to select a window on the plot. To show this window on the plot i would like to put two rectangles( one from 0 to the minimum of the window and one from the maximum of the window to the extremity of the chart.) with grey color and little bit transparent.

I checked the pain function from vtkcharxy and vtkContext2D but i have a problem with vtkContextDevice2D which is not initialize.

I don’t really know what is vtkContextDevice2D. i don’t even know if this is the good way to put transparent rectangles.

what is the best way to do this?

thank you in advance!

---

<div class="post-metadata">

### Author: ![antoine1](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/a/73ab20/32.png) [@antoine1](https://discourse.vtk.org/u/antoine1)
#### Post date: [March 27, 2023, 6:19pm UTC](https://discourse.vtk.org/t/vtkcharxy-with-rectangles/11026/2 "2023-03-27T18:19:01Z")

</div>

no one?
