Creating a drawable Graph out of Sliders

i’ve been stuck for days now trying to do a drawable graph out of customized sliders.

i created a custom component (parent) which consists of an array of LinearBarVertical sliders. They have been programmatically placed and styled using my own LookAndFeel and my own paint function.

However since i want to draw e.g. a waveform using this component,
i don’t want to use the standard mousebehaviour on sliders,
because this prevents “drawing” from left to right.

so i tried overriding the parent components hitTest to set the slidersVlaues depending on the mouseposition and if isMouseButtonDownAnywhere but i can’t get it to work.
can somebody please give me a hint and point me in the reight direction? that would be nice!

    int totalNumberOfSliders =100;

int sliderX = 10;
int sliderY = 0;
int sliderWidth =10;
int sliderHeight = 500;

bool hitTest (int x, int y) override

if ( isMouseButtonDownAnywhere() == true )

    if(y >= sliderY && y <  sliderWidth)                                               // click is inside sliders y range

        for(int i=0; i<totalNumberOfSliders; i++)                                      // iterate through sliders
                if(x >= (i*sliderX)-sliderX  && x < (i*sliderWidth))                // click is inside sliders x range
                { sliderArray.getUnchecked (i)->setValue(, dontSendNotification);}     // set clicked sliders value to y value of mouse

    return false;    


thank you in advance and thanks for reading

  • Marcel /Dangerough

This is going to be slow and a pain to manage I’d say. Why not just have two points with a line connecting them or else a bezier curve?

Yikes! wow… that’s an erm… interesting way to approach the problem! You need a single custom component there, you can’t build something like that out of other elements.

Ok thank you very much,
i thought i was almost there, since i want my graph to consist of exact “number of sliderbars” which can be set by the user in the range of “sliderRange”.

i thought now i only need a new hittest, to enable “drawing with mouse”.

but i’ll try again from scratch and go full custom component.


  • Dangerough