You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2019/04/17 01:29:31 UTC

[GitHub] [incubator-superset] AaronCH5 commented on issue #7299: How to add watermark for Superset?

AaronCH5 commented on issue #7299: How to add watermark for Superset?
URL: https://github.com/apache/incubator-superset/issues/7299#issuecomment-483902515
 
 
   I have dealt with it well and need to add extra code. At present, my way is to add <defs>, <text>(control transparency) and <rect> tag in < SVG > for implementation. I don't know whether there is a more appropriate and official way to deal with it. Always feel their own way of dealing with low.
   eg:
   For css: 
        <svg>
   	<defs>
   			<pattern id="polka-dots" x="-20" y="-20" width="120" height="120" patternUnits="userSpaceOnUse">          
   				<text dy="1em" transform="rotate(-40 120,20)" style="filter:alpha(opacity:20); opacity:0.2; font-size: 20px;font-family:20px Microsoft Yahei;">我是水印文字哦</text>
   			</pattern>
   	</defs>
   	<rect x="0" y="0" width="100%" height="100%" fill="url(#polka-dots)"></rect>
   	...
   	<g>...
   	</g>
   </svg>
   
   For js: 
   const defs = svg.append('defs')
        .append('pattern')
        .attr('id', 'polka-dots')
        .attr('x', -20)
        .attr('y', -20)
        .attr('width', 120)
        .attr('height', 120)
        .attr('patternUnits', 'userSpaceOnUse');
   
     defs.append('text')
         .attr('dy', '1em')
         .attr('transform', 'rotate(-40 120,20)')
         .style('filter', 'alpha(opacity:20)')
         .style('opacity', 0.09)
         .style('font-size', '20px')
         .style('font-family', '20px Microsoft Yahei')
         .text('我是水印文字哦')
   
     svg.append('rect')
        .attr('x', '0')
        .attr('y', '0')
        .attr('width', '100%')
        .attr('height', '100%')
        .style('fill', 'url(#polka-dots)');
   
   PS: At present, the code is not functional processing, all fixed values.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org