vendor: 4,484 bytes, lines 1-127
1/* * 2 * 3 * (c) 2010-2024 Torstein Honsi 4 * 5 * License: www.highcharts.com/license 6 * 7 * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! 8 * 9 * */ 10'use strict'; 11import U from '../Utilities.js'; 12const { extend, merge, pick } = U; 13/* * 14 * 15 * Namespace 16 * 17 * */ 18var LegendSymbol; 19(function (LegendSymbol) { 20 /* * 21 * 22 * Functions 23 * 24 * */ 25 /** 26 * Draw a line, a point marker and an area in the legend. 27 * 28 * @private 29 * @function Highcharts.LegendSymbolMixin.areaMarker 30 * 31 * @param {Highcharts.Legend} legend 32 * The legend object. 33 */ 34 function areaMarker(legend, item) { 35 lineMarker.call(this, legend, item, true); 36 } 37 LegendSymbol.areaMarker = areaMarker; 38 /** 39 * Draw a line and a point marker in the legend. 40 * 41 * @private 42 * @function Highcharts.LegendSymbolMixin.lineMarker 43 * 44 * @param {Highcharts.Legend} legend 45 * The legend object. 46 */ 47 function lineMarker(legend, item, hasArea) { 48 const legendItem = this.legendItem = this.legendItem || {}, { chart, options } = this, { baseline = 0, symbolWidth, symbolHeight } = legend, symbol = this.symbol || 'circle', generalRadius = symbolHeight / 2, renderer = chart.renderer, legendItemGroup = legendItem.group, verticalCenter = baseline - Math.round((legend.fontMetrics?.b || symbolHeight) * 49 // Render line and marker slightly higher to make room for the 50 // area 51 (hasArea ? 0.4 : 0.3)), attr = {}; 52 let legendSymbol, markerOptions = options.marker, lineSizer = 0; 53 // Draw the line 54 if (!chart.styledMode) { 55 attr['stroke-width'] = Math.min(options.lineWidth || 0, 24); 56 if (options.dashStyle) { 57 attr.dashstyle = options.dashStyle; 58 } 59 else if (options.linecap !== 'square') { 60 attr['stroke-linecap'] = 'round'; 61 } 62 } 63 legendItem.line = renderer 64 .path() 65 .addClass('highcharts-graph') 66 .attr(attr) 67 .add(legendItemGroup); 68 if (hasArea) { 69 legendItem.area = renderer 70 .path() 71 .addClass('highcharts-area') 72 .add(legendItemGroup); 73 } 74 if (attr['stroke-linecap']) { 75 lineSizer = Math.min(legendItem.line.strokeWidth(), symbolWidth) / 2; 76 } 77 if (symbolWidth) { 78 const d = [ 79 ['M', lineSizer, verticalCenter], 80 ['L', symbolWidth - lineSizer, verticalCenter] 81 ]; 82 legendItem.line.attr({ d }); 83 legendItem.area?.attr({ 84 d: [ 85 ...d, 86 ['L', symbolWidth - lineSizer, baseline], 87 ['L', lineSizer, baseline] 88 ] 89 }); 90 } 91 // Draw the marker 92 if (markerOptions && markerOptions.enabled !== false && symbolWidth) { 93 // Do not allow the marker to be larger than the symbolHeight 94 let radius = Math.min(pick(markerOptions.radius, generalRadius), generalRadius); 95 // Restrict symbol markers size 96 if (symbol.indexOf('url') === 0) { 97 markerOptions = merge(markerOptions, { 98 width: symbolHeight, 99 height: symbolHeight 100 }); 101 radius = 0; 102 } 103 legendItem.symbol = legendSymbol = renderer 104 .symbol(symbol, (symbolWidth / 2) - radius, verticalCenter - radius, 2 * radius, 2 * radius, extend({ context: 'legend' }, markerOptions)) 105 .addClass('highcharts-point') 106 .add(legendItemGroup); 107 legendSymbol.isMarker = true; 108 } 109 } 110 LegendSymbol.lineMarker = lineMarker; 111 /** 112 * Get the series' symbol in the legend. 113 * 114 * This method should be overridable to create custom symbols through 115 * Highcharts.seriesTypes[type].prototype.drawLegendSymbol. 116 * 117 * @private 118 * @function Highcharts.LegendSymbolMixin.rectangle 119 * 120 * @param {Highcharts.Legend} legend 121 * The legend object 122 * 123 * @param {Highcharts.Point|Highcharts.Series} item 124 * The series (this) or point 125 */ 126 function rectangle(legend, item) { 127 const legendItem = item.legendItem || {}, options = legend.options, symbolHeight = legend.symbolHeight, square = options.squareSymbol, symbolWi
127dth = square ? symbolHeight : legend.symbolWidth; 128 legendItem.symbol = this.chart.renderer 129 .rect(square ? (legend.symbolWidth - symbolHeight) / 2 : 0, legend.baseline - symbolHeight + 1, // #3988 130 symbolWidth, symbolHeight, pick(legend.options.symbolRadius, symbolHeight / 2)) 131 .addClass('highcharts-point') 132 .attr({ 133 zIndex: 3 134 }) 135 .add(legendItem.group); 136 } 137 LegendSymbol.rectangle = rectangle; 138})(LegendSymbol || (LegendSymbol = {})); 139/* * 140 * 141 * Default Export 142 * 143 * */ 144export default LegendSymbol;
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.