QCustomPlot Discussion and Comments

how to change the intensity of curve colour in Qcustomplot with respect to x-axis?Return to overview

I have a problem where I have to plot a ray from some source.At source the intensity should be strongest and should decrease with distance which is my xaxis.If I am using blue colour to plot my ray than it should be light blue at origin and should darken with distance.

I have attached a QCpcurve to QCustomplot.

There are two vectors say X and Y which I have to plot

Problem is that how to change the colour intensity as distance increases.

Please help

you cant with the default implementation of the QCPCurve. if you take a look at the source code, the pen doesnt get set per data point, it gets set across the entire curve. if you want this kind of implementation, i think you would have to use a QCPColorMap or subclass QCPCurve and reimplement the paint method.