[vtkusers] Scalar bar with discrete values

Karl Merkley karl at elemtech.com
Fri Feb 24 10:04:48 EST 2012


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





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120224/38bc44e3/attachment.htm>


More information about the vtkusers mailing list