[Paraview] Set color legend font color (pv web)
Scott Wittenburg
scott.wittenburg at kitware.com
Tue May 2 14:39:14 EDT 2017
That protocols.py code snippet looks kind of old, what version of ParaView
are you running? I don't recall precisely when we dropped the pipeline
manager abstraction in favor of the proxy manager, but it seems like awhile
ago. Any chance you can update to a more recent paraview? If you're on
Linux and using binary distributions, avoid version 5.3. The 5.2 binary
might be ok for you, or building from master should be fine.
Hope this helps,
Scott
On Tue, May 2, 2017 at 1:16 AM, Daniel Zuidinga <info at seoaachen.de> wrote:
> 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 = ''
> vtkSMScalarBarWidgetRepresenta
> tionProxy.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>
> 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
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the ParaView Wiki at:
>> http://paraview.org/Wiki/ParaView
>>
>> Search the list archives at: http://markmail.org/search/?q=ParaView
>>
>> Follow this link to subscribe/unsubscribe:
>> http://public.kitware.com/mailman/listinfo/paraview
>>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20170502/e2f02d05/attachment.html>
More information about the ParaView
mailing list