Adding a SVG image to symbol in highcharts - highcharts

I am trying to set the symbol of the context menu using this :
Highcharts.getOptions().exporting.buttons.contextButton.symbol = url('path to a external link');
This way I am able to change the icon of 'symbol'.
Now I want to use a SVG image in my workspace
Highcharts.getOptions().exporting.buttons.contextButton.symbol = url('path to img file in repo');
How do I set the path to a SVG image in my local repo?

The export button is rendered as an SVG path, so it can't be overridden by CSS.
Here is a guideline how to use custom symbols: https://api.highcharts.com/highcharts/exporting.buttons.contextButton.symbol

Related

How to configure the global tooltip style in echarts

there are multiple places that use tooltip in the project, how to unify the style
in addition to configuration in each tooltip, is there any other way?enter image description here
enter image description here

Is HighCharts custom marker symbol shape modifiable?

In the Documents symbol can pass url() for displaying custom image symbol, but if my image is square and I need it to display as rounded shape, is HighCharts supporting this or I need custom css to do that?
Highcharts only gives the possibility to set custom marker symbol using url(), but under the hood that symbol occurs as an SVGImageElement, so basically it is not able to apply the for example border-radius parameter on it.
The simplest way to achieve the effect you need is by editing the image.
Also you can dynamically add the <rect> element for every symbol and set it as a clipRect of a specific image.
Best regards!

Using TBitmapLinks with the FireMonkey Style Designer

I have been styling FireMonkey controls, but there is one issue that I have been having some real issues with, and that is how to incorporate bitmaps into FireMonkey styles using the FireMonkey Style Designer (and specifically not the Bitmap Style Designer). Certain styled objects (TButtonStyleObject, for example), have BitmapLink properties, but I cannot see how they are working in the new custom styles that are generated for a FireMonkey control.
Let me try to make the problem as transparent as possible. I add a StyleBook and set its Resource to the MetropolisUIGreen.Style in Delphi's Style directory (in XE7 this is located in C:\Users\Public\Documents\Embarcadero\Studio\16.0\Styles). I then open the FireMonkey Style Designer and locate the buttonstyle style, which consists of a TButtonStyleObject and a TButtonStyleTextObject, both parented to a TLayout. The TButtonStyleObject has a SourceLookup property value of MetroGreenstyle.png, which is a StyleName assoiated with a TImage into which the MetropolisUIGreen.png image has been loaded.
With the TButtonStyleObject (whose StyleName is background) selected, I examine the NormalLink property, which is a collection of TBitmapLinks. It is my understanding that the one BitmapLink that I see defined in NormalLink contains information about the bitmap that should be used for the button, including the coordinates (SourceRect) corresponding to a rectangular region of the MetroGreenstyle.png file.
My assumptions appear to be wrong, because when I examine MetroGreenstyle.png using a graphics program, there is nothing interesting at these coordinates. I have examined the BitmapLinks of many other styles, and there too I find that the SourceRect coordinates do not seem to actually define a meaningful region of the stylelookup png file.
I obviously have this wrong. How does the SourceRect coordinates of a BitmapLink define the bitmap that FireMonkey should use when rendering a control.
-- Edit I actually asked four question. I have updated this question to include just one question. I will include the other questions in another post. --
I think there is a difference between the bitmap embedded in the .style file (embedded as a resource) and the one stored in the file (C:\Users\Public\Documents\Embarcadero\Studio\15.0\Styles\MetropolisUIGreen.png, that is 519x760).
The embedded bitmap seems to be different in size than the external file (you can check that by looking in the Style Editor, selecting the metrogreenstyle.png node, opening the property editor for MultiResBitmap and looking at the image size provided for Scale 1.00: 750x850.
This explains why coordinates seems all wrong. I don't know if it is the external file to be out of date or the opposite.
HTH!
Update: I managed to extract the bitmap stored in the .style file and I can confirm the coordinates are relative to that bitmap!
Update(2):
.Style files and .fmx file are very similar so you can do:
1) open MetropolisUIGreen.Style with a text editor and locate the embedded bitmap (line 18), you can see:
object TImage
StyleName = 'MetroGreenstyle.png'
MultiResBitmap = <
item
Width = 0
Height = 0
PNG = {...}
2) create a new FMX application, add a TImage on the form and load a bitmap (any picture you want)
3) copy the PNG value from the .Style file into the XFM file. Beware to also fix the Width and Height properties:
MultiResBitmap = <
item
Width = 750
Height = 850
PNG = {...}
4) you should be able to see the picture at design time;
5) add a button with Image1.Bitmap.SaveToFile('C:\temp\new_file.png');
run the program and save the file to your disk. :-)
I'd like to verify Andreas solution. This is what I did.
Exported the .png as Andrea described
Opened the .png in Photoshop and changed some of the various objects
Saved the .png from Photoshop
Loaded it into the temp project TImage I used to export it in step 1.
Alt+F12 and copied the png content into the clipboard
Pasted it directly into my .style file (with Ultraedit)
Loaded the .style file in the style editor in Delphi
All the color changes was emediatly reflected in my design. Possibly there is a simpler way, but I don't know it. I did this in XE10 Seattle.

Inkscape - Change SVG color using command line tool

Is it possible to change color of an SVG file to a single color, using inkscape on the command line?
For example, I have an SVG document with different colors like '#ffffff', '#004883', '#e32934'.
So with a command line tool is it possible to change this Pepsi logo to a single color file. I mean the the Pepsi logo should be completely in the red OR blue color.
If it's not possible with inkscape, is it possible with any other open source library (command line tool) for Linux? Thanks in advance.

Combined background color and image in shape

I want to set this style for an SVG <path>:
background-color: red;
background-image: url('myImage.png');
This picture has transparent pixels and I need background color to fill it.
What you would do in SVG is to define a <pattern> that contains a rect with the color you want and the image you want, and then use that as fill for the <path>.
See this example from the SVG testsuite.
'background-image' and 'background-color' don't apply to svg content unless it's handled by the CSS box model (so basically just the root svg element).
I'm reasonably sure you cannot have an image with a background colour in one path.
You can however replicate the effect by having two paths in the same position, with the image path on top of the solid colour path.

Resources