[vtkusers] Scalar bar with discrete values
John Platt
jcplatt at dsl.pipex.com
Fri Feb 24 10:43:11 EST 2012
Hi Karl,
I made 3 additions to vtkScalarBarActor some time ago...
1. Set a ceiling on the text font size.
2. Allow a different title to be used when the legend is horizontal.
3. Supply discrete labels.
The extend class is attached - it may require updating for your VTK version.
HTH
John.
----- Original Message -----
From: Karl Merkley
To: VTK
Sent: Friday, February 24, 2012 3:04 PM
Subject: Re: [vtkusers] Scalar bar with discrete values
Setting the number of labels does help but it doesn't give me the discrete values on the scalar bar. For example, if I have three discrete values .4, .5, 1.25. The scalar bar displays .4 .825, 1.25. The .825 appears to be just average of the minimum and the maximum for the three value case.
Looking the source code for vtkScalarBarActor::AllocateAndSizeLabels(...), it looks like the interior values of scalar bar are a function of the range and the number of labels. There is no way to specify the discrete values. It looks like I will have to subclass vtkScalarBarActor and overload AllocateAndSizeLabels. Fortunately, it is a virtual method!
-- Karl
On Feb 23, 2012, at 2:33 AM, Jothybasu Selvaraj wrote:
You could do that by
//For 10 labels
scalarBar->SetMaximumNumberOfColors(10);
scalarBar->SetNumberOfLabels(10);
Jothy
On Thu, Feb 23, 2012 at 12:10 AM, Karl Merkley <karl at elemtech.com> wrote:
I have a set of discrete values (thicknesses) that I want to describe with a scalar bar. Each color has exactly one value associated with it. When I set up my scalar bar it has a range defined by each color. Is there a way to get a single label drawn at the center of the color range instead of labels at the tops and bottoms of each range?
Thanks,
Karl
_______________________________________________
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
--
Jothy
_______________________________________________
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
---------------------------
Karl Merkley, Ph.D.
Elemental Technologies, Inc.
Computational Simulation Software, LLC
www.csimsoft.com
Office: 1-801-756-1972, ext 1
------------------------------------------------------------------------------
_______________________________________________
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 --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120224/e7bdf1a3/attachment.htm>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: vtkScalarBarActorEx.h
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120224/e7bdf1a3/attachment.asc>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: vtkScalarBarActorEx.cpp
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120224/e7bdf1a3/attachment.txt>
More information about the vtkusers
mailing list