[Paraview] Set color legend font color (pv web)

Daniel Zuidinga info at seoaachen.de
Tue May 2 03:16:28 EDT 2017


As I've said I edited the protocols.py of paraview web:

   @exportRpc("pv.pipeline.manager.scalarbar.visibility.update")
     def updateScalarbarVisibility(self, options):
         lutMgr = vtkSMTransferFunctionManager()
         lutMap = {}
         view = self.getView(-1)
         if options:
             for key, lut in options.iteritems():
                 visibility = lut['enabled']
                 if type(lut['name']) == unicode:
                     lut['name'] = str(lut['name'])
                 parts = key.split('_')
                 arrayName = parts[0]
                 numComps = int(parts[1])

                 lutProxy = self.getColorTransferFunction(arrayName)
                 barRep = 
servermanager._getPyProxy(lutMgr.GetScalarBarRepresentation(lutProxy, 
view.SMProxy))

                 if visibility == 1:
                     barRep.Visibility = 1

#EDIT#
                     barRep.TitleColor=[1.0,0.0,0.0]
                     barRep.LabelColor=[1.0,0.0,0.0]

                     barRep.Enabled = 1
                     barRep.Title = arrayName
                     if numComps > 1:
                         barRep.ComponentTitle = 'Magnitude'
                     else:
                         barRep.ComponentTitle = ''
vtkSMScalarBarWidgetRepresentationProxy.PlaceInView(barRep.SMProxy, 
view.SMProxy)
                 else:
                     barRep.Visibility = 0
                     barRep.Enabled = 0

                 lutMap[key] = { 'lutId': lut['name'],
                                         'name': arrayName,
                                         'size': numComps,
                                         'enabled': visibility }
         return lutMap


Am 01.05.2017 um 21:03 schrieb Scott Wittenburg:
> Maybe we need to see more context (how you got your hands on barRep, 
> and what else you did)?  I just used ParaView Qt client to visualize 
> the wavelet, and I changed these colors before exporting the state as 
> a python script.  I think the following covers what you should need to 
> do:
>
> from paraview.simple import *
> ...
> rv1 = CreateView('RenderView')
> ...
> lut = GetColorTransferFunction('RTData')
> ...
> repr = Show(someSrc, rv1)
> repr.LookupTable = lut
> ...
> repr.SetScalarBarVisibility(rv1, True)
> ...
> lutColorBar = GetScalarBar(lut, rv1)
> lutColorBar.TitleColor = [...]
> lutColorBar.LabelColor = [...]
>
> Then finally maybe a Render() is required?
>
> If you do all that and the color doesn't change, there may be a bug.  
> Even though the protocols we have now do not allow for changing the 
> title and label color (at least not to my knowledge), you can manage 
> this all in your application code.
>
> Hope this helps,
> Scott
>
>
> On Mon, May 1, 2017 at 12:00 PM, Daniel Zuidinga <info at seoaachen.de 
> <mailto:info at seoaachen.de>> wrote:
>
>     Hi,
>
>     I try to set the color legend font color in protocols.py of
>     paraview web visualizer.
>
>     def updateScalarbarVisibility(self, options):
>         ...
>        barRep.TitleColor=[0.0,0.0,0.0]
>        barRep.LabelColor=[0.0,0.0,0.0]
>
>     but it doesn't change the color. Where can I change it (default)?
>     I would also show it as default.
>
>     regards
>     Daniel
>     _______________________________________________
>     Powered by www.kitware.com <http://www.kitware.com>
>
>     Visit other Kitware open-source projects at
>     http://www.kitware.com/opensource/opensource.html
>     <http://www.kitware.com/opensource/opensource.html>
>
>     Please keep messages on-topic and check the ParaView Wiki at:
>     http://paraview.org/Wiki/ParaView <http://paraview.org/Wiki/ParaView>
>
>     Search the list archives at:
>     http://markmail.org/search/?q=ParaView
>     <http://markmail.org/search/?q=ParaView>
>
>     Follow this link to subscribe/unsubscribe:
>     http://public.kitware.com/mailman/listinfo/paraview
>     <http://public.kitware.com/mailman/listinfo/paraview>
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20170502/baf8a716/attachment.html>


More information about the ParaView mailing list