[vtkusers] Chart question

Thompson, David C dcthomp at sandia.gov
Fri Nov 19 23:00:45 EST 2010


For the curious, the result is attached. It uses a vtkArrayCalculator to sample
a formula you feed it each time the x bounds change. My next step is to
make a plot that fetches a subset of a large tabular function off disk instead
of evaluating an equation (easy enough), and then to make it work in a ParaView
client-server view.

I think the last will cause trouble for this approach of overriding Paint() since
ParaView chart rendering happens on the client away from the data. The best
"easy" thing I can think of is to have a hidden plot on the client that sets new
bounds on proxies which fetch data on the server. With a little padding on the
chart bounds perhaps this might not be too bad. But I guess that's a question
for the paraview list...

    Thanks again,
    David
________________________________________
From: vtkusers-bounces at vtk.org [vtkusers-bounces at vtk.org] On Behalf Of Thompson, David C [dcthomp at sandia.gov]
Sent: Friday, November 19, 2010 13:01
To: Marcus D. Hanwell; Eric E. Monson
Cc: VTK Users
Subject: Re: [vtkusers] Chart question

Eric and Marcus,

I'll try inheriting a vtkPlot class and force an update of its dataset inside Paint() as that
seems simplest. If I have trouble, then maybe having vtkAxis emit an event would be
helpful.

    Thanks much,
    David

________________________________________
From: Marcus D. Hanwell [marcus.hanwell at kitware.com]
Sent: Friday, November 19, 2010 11:13
To: Eric E. Monson
Cc: Thompson, David C; VTK Users
Subject: Re: [vtkusers] Chart question

On Fri, Nov 19, 2010 at 10:03 AM, Eric E. Monson <emonson at cs.duke.edu> wrote:
> Hey David,
>
> My feeling is that there isn't a nice, clean way to do this right now. I would be tempted to subclass vtkAxis and add in a custom event which would allow you to watch for when the max and min values change (which are in the data coordinates) and then recalculate your data based on that, feeding in a new input table to the plot. Because the ChartXY axes are kept in a private data storage, it may force you to re-implement a lot of the ChartXY methods just to change the axis class, though...

We could add the event to vtkAxis, I had not considered this use case.
I could also add a private header with all of the private members of
vtkChartXY, and examine what could just be in the main class to reduce
the burden on anyone making a derived chart class.
>
> Since you would have to deal with panning, rubber-band zooming and mouse wheel zooming, it might be a pain, but in principle you could just observe all of the important mouse events for the chart's interactor and then check whether the axis ranges have changed.

Possibly a new event in the chart classes? I could see that being
generally useful.
>
> I'm having a little trouble thinking through, though, what will happen with the auto axis ticks and plot bounds when you're constantly changing the input data... You'll want it to do auto-nice axis ticks and labels rather than doing it manually, but I'm not sure if the default behavior will be to try to rescale the axis ranges to the data range (which may be fine for you in one direction but not the other), and whether that will cause some weird jumpiness or whether it will be okay...

I think you would have to set the bounds, as the charts query the
input data for their bounds, with some special treatment for NaN etc.
>
> Probably Marcus will have some better ideas.
>
I had thought about plotting mathematical functions, and using a Plot
object derived from vtkPlotLine, where it could either cache the
function's output, or just recalculate the values over the range. The
plots already get access to the vtkAxis and so can query the axis
bounds on paint/update calls.

My approach would be a subclass of vtkPlot, where I generated the data
based on the axis range either in the update of paint method. Let me
know if you need any more details, and it would not require you to
derive from the chart class.

Marcus


_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PlotFormula.tgz
Type: application/x-gzip
Size: 4068 bytes
Desc: PlotFormula.tgz
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20101119/3c892ea3/attachment.bin>


More information about the vtkusers mailing list