score:28
API Reference of plotOptions.series.marker.symbol
symbol: String
A predefined shape or symbol for the marker. When null, the symbol is pulled from options.symbols. Other possible values are "circle", "square", "diamond", "triangle" and "triangle-down".
Additionally, the URL to a graphic can be given on this form: "url(graphic.png)". Note that for the image to be applied to exported charts, its URL needs to be accessible by the export server.
Custom callbacks for symbol path generation can also be added to Highcharts.SVGRenderer.prototype.symbols. The callback is then used by its method name, as shown in the demo.
Like in the last paragraph above, we would define the symbol path for creating a plus. Here is what the documentaion says about Renderer.path
Add a path based on SVG's path commands. In SVG capable browsers all path commands are supported, but in VML only a subset is supported: absolute moveTo (M), absolute lineTo (L), absolute curveTo (C) and close (Z).
And this is how the co-ordinate system would look like, the actual point at the centre of a w x h box with its top-left corner placed at (x,y) & y increasing as we move downwards and x increasing as we move towards the right.
Here is how you would do a plus
// Define a custom symbol path
Highcharts.SVGRenderer.prototype.symbols.plus = function (x, y, w, h) {
return ['M', x, y + h / 2, 'L', x + w, y + h / 2, 'M', x + w / 2, y, 'L', x + w / 2, y + h, 'z'];
};
if (Highcharts.VMLRenderer) {
Highcharts.VMLRenderer.prototype.symbols.plus = Highcharts.SVGRenderer.prototype.symbols.plus;
}
To explain the array in words
'M', x, y + h / 2
: We move our pen to pt. A (x,y+h/2)'L', x + w, y + h / 2:
We draw a line from the current position to pt. B (x+w,y+h/2). This draws the horizontal line of the plus from A <-> B'M', x + w / 2, y:
We now move the pen to pt. C (x+w/2,y), notice that moving the pen does not create any graphic or line'L', x + w / 2, y + h:
We now draw a line from current position to pt. D(x+w/2,y+h). This draws the vertical line of the plus C <-> D'z':
We close the renderer/pen
score:6
The accepted answer only gives a single line per cross. I wanted a fully filled in plus sign. Here is the code to instead do that:
Highcharts.SVGRenderer.prototype.symbols.plus = function (x, y, w, h) {
return [
'M', x, y + (5 * h) / 8,
'L', x, y + (3 * h) / 8,
'L', x + (3 * w) / 8, y + (3 * h) / 8,
'L', x + (3 * w) / 8, y,
'L', x + (5 * w) / 8, y,
'L', x + (5 * w) / 8, y + (3 * h) / 8,
'L', x + w, y + (3 * h) / 8,
'L', x + w, y + (5 * h) / 8,
'L', x + (5 * w) / 8, y + (5 * h) / 8,
'L', x + (5 * w) / 8, y + h,
'L', x + (3 * w) / 8, y + h,
'L', x + (3 * w) / 8, y + (5 * h) / 8,
'L', x, y + (5 * h) / 8,
'z'
];
};
if (Highcharts.VMLRenderer) {
Highcharts.VMLRenderer.prototype.symbols.plus = Highcharts.SVGRenderer.prototype.symbols.plus;
}
This will produce a plus at 25% width for each bar.
Source: stackoverflow.com
Related Query
- Extend highcharts renderer symbols to have plus sign
- How to have multiple highcharts with different series data in vuejs without repeating code
- Highcharts - how to have a chart with dynamic height?
- How can I force multiple y-axis in Highcharts to have a common zero
- Highcharts remove renderer path
- Does Highcharts have a "trend line" feature?
- Highcharts - yAxis logarithmic scale and allowDecimals set to false not seeming to have any effect
- Animate stroke-width with Highcharts renderer
- Highcharts pie charts can have url links
- Is it possible in highcharts to have 2 charts, sharing the same x-axis, but next to one another?
- How to properly align Font Awesome symbols on Highcharts scatter plots?
- Using PhantomJS to create HighCharts grahps server side for use in PDF creation (PHP) - results in exit code 11 from PHPs exec();
- How can i force Highcharts to use same symbols in Legend and Series?
- Highcharts custom renderer chart and tooltip
- Highcharts - Global configuration with common code and unique data & Headings
- Highcharts area spline values have incorrect position on y-axis
- HighCharts dynamically resize renderer label or element
- highcharts have data Labels only on some points
- HighCharts Stock Chart error code 18
- highcharts change rendered image source on click
- highcharts - error when updating a series to have less categories than previously
- Highcharts Image Renderer Auto Height
- How do i add mouse wheel code in Angular2 highcharts in typescript
- how to display 2 same highcharts without duplicate the code
- Use of DotNet HighCharts dll to make charts in code behind
- Why do I have the issue 'property assigment expected' when I want to display a chart on my web page using highcharts
- How to edit tooltip in Highcharts C# code
- what means ${demo.css} in example files of highcharts ? That piece of code seems to be literal
- Have some bars not a url link on highcharts
- passing json values to highcharts from .net code behind
More Query from same tag
- Highcharts x axis date format issues
- Highchart: drawgraph based on chart name
- How can I change the background color of horizontal bar if date value is less than to current date?
- Format tooltip in highchart map for dynamic variables, some with commas and others with percents
- Manipulating array to add through setData on highcharts
- Rendering multiple charts with React
- Renaming items in export menu in highcharts
- In Highcharts, how to redraw chart after legend item width resized?
- dynamically adding series to highcharts
- Is it possible to export HTML along with SVG markup to the Highcharts Export Server (http://export.highcharts.com/)
- Javascript parameter is returned as both value and undefined
- How do I hide specific legend items?
- Specify color for each point in scatter3d
- Highcharts: Deselect all points within a series
- Auto-refresh Json data in Highcharts
- How to Control the highchart, based on external click event
- Highcharts gantt chart task progress indicator data labels for multi-color in a single task progress
- Title below Pie charts
- How to create Waterfall model chart using QuickChart?
- Highcharts: how to set legend label name after chart created?
- shift y-axis from dumbell chart within the line
- add event to x-axis labels of bar highchart
- Can a Highcharts range selector use non-date linear ranges?
- highcharts does not seem to be rendering
- How do I redraw a series on HighCharts?
- Highcharts does not work with wicked_pdf
- Highcharts - updating series leads to tooltip-related error (mouseOver)
- How to insert HTML inside an Ext.each() in the labeFormatter function of legend-EXTJS -highcharts
- Pie chart from highcharts does not render via justpy
- highcharts solid gauge: bigger tick marks