All Questions
Tagged with legend javascript
247
questions
0
votes
1
answer
31
views
Is it possible to count the occurrence number of a custom icon in Leaflet? If yes, how to do it?
Firstly, I'm a beginner, I've learned a lot from you.
I have 5 custom icons defined:
//Awesome icons
var LeafIcon = L.Icon.extend({
options: {
shadowUrl: "markers-shadow.png",
...
0
votes
0
answers
8
views
Adapting the leaflet.js Choropleth example with non static legend
I am trying to use the beautiful base example Choropleth, but would like to have a second base map, with a second legend that would be linked to the base map used (therefore not anymore static), with ...
0
votes
1
answer
40
views
Why the legend merged with the d3.js line chart when zooming?
I am trying to add a legend to the d3.js example named
Line chart with zoom in d3.js
1°) I added the script:
// Add legend rectangle
line.append('rect')
.attr('x', width - 80)
....
0
votes
1
answer
40
views
How to prevent hiding plotly chart bar on chart legend click
How to prevent hiding plotly chart bar on chart legend click in an angular application.
<plotly-plot
[divId]="graph.selectedGraph.name"
[data]="graph.selectedGraph....
0
votes
1
answer
248
views
How to add spacing between Legend and Chart in Recharts with absolute positioning?
I'm using Recharts for the first time in my React project
I've positioned the legend of my BarChart component to the top right corner.
However, I'm struggling to add spacing between the legend and the ...
0
votes
1
answer
38
views
Shared legend for 2 Highcharts using React
I want a shared legend for 2 areaspline highcharts. Using react, I am unable to create that shared legend between the 2.
My code:
component.js:
import React from "react";
import "...
0
votes
1
answer
48
views
How to Display Values Next to Legend in React Pie Chart? Getting 'Undefined' Error
I am trying to display value next to legend, but I am getting undefined.
Debugged but no luck, can you let me know how to fix it.
Providing my code snippet and stackblitz below
https://stackblitz.com/...
0
votes
0
answers
23
views
Highmaps mapbubble legend moves when zooming in the map
I use Highmaps to display bubbles on a mapline. Everything works well but if I display in the legend the color axis and the size of bubbles, there is a strange behavior when I zoom in the map.
The ...
0
votes
0
answers
206
views
Chart js - v 4 How can I change the order of chart legend
The legend was created using the html Legend Plugin, which is displayed differently from the order in which you draw the chart
Is there a way to change the legend order to match the data order?
I ...
0
votes
1
answer
17
views
How can I implement tooltips for Rickshaw legends?
I'm using Rickshaw to display a graph of several time series with a legend. I would like to display some text when the user hovers the mouse cursor over an entry in the legend. There is apparently no ...
0
votes
1
answer
2k
views
apexcharts legend with values
I have created a apexcharts. now i want to show all series data in legend like this
i want like this
my code -
new ApexCharts(document.querySelector("#noOfPoc"), {
series: [32, 2, 1, 1],
...
0
votes
0
answers
25
views
How can we change the position of legend using highcharts?
I am building a pie chart with highcharts js, but having a problem.
As shown below, I was able to put the legend on the bottom, but it's not aligned with the chart. I am trying to put the legend at ...
1
vote
0
answers
820
views
ApexCharts Grouped Stacked Chart: Group legend labels
I'm using ApexCharts to generate some charts and the "new" grouped stacked column charts comes in handy for some of them.
Now I was wondering, if it was already possible to also group the ...
0
votes
1
answer
35
views
change the language of the legend in dygraph in r
I have done this. Edited
the dygraph-combined.js changing the names of months and days, for example, replace text "Oct" with "Okt" and so on, to change the language of the date ...
1
vote
2
answers
831
views
Add line for echarts legend icon
I want to realize echart legend icon with line
I want to implement a circle icon with horizontal lines as show in fig. 1.
fig. 1 circle icon with lines
Friends online say line is the default, but my ...
3
votes
1
answer
378
views
Creating a legend for a scatter plot in D3
I have written the following code snippets to create a legend for a scatter plot.
Basically, it is a simple example that uses Susie Lu's D3-legend module to create a legend for a scatter plot.
The ...
1
vote
1
answer
1k
views
react-chartjs-2 how to show legend text on the left with vertical text
I just want to align the Chart Legend on the right and the text will be shown vertically.
Goal:
enter image description here
I've tried to use: position: left
enter image description here
The legend ...
2
votes
2
answers
49
views
Different shape based on datum
I am trying to append another shape when one of the values satisfy the condition as follows:
const keys = ["A", "B", "C", "D", "E", "E", "G"]
const colors = ['#1e90ff', '#008000', '#d3d3d3', '#...
0
votes
1
answer
173
views
Convert continuous colors(legend) to color as stepwise constant (discrete colors) in linear gradient
I am creating a continuous legend (have created using linear gradient). Now I want to convert same legend to look like discrete legend (have constant stepwise values). I have shared the images like ...
2
votes
2
answers
3k
views
How to create color picker with extra functionality like choosing color from screen
I have an colorpicker which i created using react-color (https://casesandberg.github.io/react-color/) . Now I want extra functionality like it should also be able to choose the color from screen (...
0
votes
0
answers
39
views
how to add missing value on the legend in map visualization javascript?
I am trying to use map visualization and I have some missing state in my data.
I added a condition for missing value to fill the map in red. Here is my code:
{
var projection = projection1;
//...
0
votes
0
answers
776
views
Chart JS 3.9 - bar chart with multiple legend labels for one dataset
Current results
As seen in this picture, I would like additional legends that is matching the colors.
Like Apples are shown with the color green, I would also like to show 'Bananas' for orange', '...
2
votes
0
answers
492
views
Echarts Legend overlap Chart
The legend of chart overlaps Chart
Heres the example of legend
legend={
width: '95%',
type: 'scroll',
orient: 'vertical'
}
[![Chart][1]][1]
[1]: https://i.sstatic.net/...
1
vote
1
answer
144
views
How to fix overlapping tick labels for svg legend using D3
I have an color legend created using linear gradient and D3 concept. The issue currently I am facing is that the ticks labels of the legend gets overlapped.
I have to show the Min and Max values all ...
1
vote
1
answer
749
views
How can I copy text from a single legend entry in plotly graphic?
I'm trying to select the text of a single entry/trace from a plotly plot.
By default, text is not selectable at all from my plot, which I generated like this:
In my R Markdown script, an R code chunk ...
0
votes
1
answer
527
views
Why the labels under chart are not corresponding with labels in legend in Chart.js for bar chart?
I would like to make a chart with labels on xAxes and the same labels in the legend. I was trying different solutions, but the best I got is the snippet below. I don't understand, why all bars are ...
0
votes
0
answers
94
views
Issue with creating legend if min and max value supplied are not in between 0 and 1
I have created continuous legend using scale Linear in d3js and it works fine. But I also have scenario where min and max value are not in between 0 and 1 but have value [2315, 4516].
So I am passing ...
2
votes
1
answer
187
views
How to use logarithm sampling if data are between 0 and 1 to create legend using D3
I am creating an continuous legend(have created using linear gradient) using D3 for linear sampling. Now I have to use same legend for logarithm sampling. But my data are between 0 and 1 as shown ...
0
votes
2
answers
274
views
Reverse the direction of the color in linear gradient legend
I have an continuous legend(both vertical and horizontal) and currently the color are flown from red to blue but I want it to be in reverse direction like from blue to red. I have shared by code ...
0
votes
0
answers
90
views
How we can implement the same functionality of onClick of legend as we have for hover in Pie chart Highcharts?
How we can implement the same functionality of onClick of legend as we have for hover in Pie chart in Highcharts?
I want to implement the same functionality on click of legend as we have for hover.
eg....
0
votes
1
answer
163
views
Highcharts same legend color as of the Pie chart slice color?
I want to have the same colour for legend text as the corresponding slice colour have in Pie chart. I have seen by default the dot before legend text takes the colour of slice colour but not text of ...
0
votes
1
answer
147
views
Hide a specific legend only from FusionChart
How to hide a specific legend from multi-series fusionChart. Actually I want to remove a specific series from chart, when exporting I need to show that on excel sheet. So my plan is initial time hide ...
0
votes
1
answer
1k
views
Legend position is not vertically in middle in Donut chart
In Donut chart Legend position is right but i want to add vertically in middle with corresponding of circle.
I am new to chartjs and JavaScript. Below is my code snippet. I am trying to load the pie/...
0
votes
1
answer
1k
views
Legend in openlayers with HTML tag
I'm using the following code to create the legends in Openlayers http://viglino.github.io/ol-ext/examples/legend/map.control.legendstat.html.
A question, I would like to insert html tag, for example, ...
0
votes
0
answers
587
views
ChartJS: How to force redraw after hiding data items clicking on legend?
I've a ChartJS pie chart, where I draw the labels myself.
This works fine - until the legend comes into play.
const options = {
layout: {
...
},
plugins: {
...
0
votes
1
answer
464
views
How to avoid overlapping and stack long text legends in D3 graph?
I have D3 graph base on Multi-line graph 3 with v7: Legend, this sample contains few and shorts legends for the graph. In my sample I want to increase the length for legends and stack the data if is ...
1
vote
1
answer
315
views
D3 map legend issue
I am creating a population map of the US. I have the map and legend working, but I made a drop down menu that allows me to filter by race. This works and changes the data on the map and legend, but I ...
0
votes
2
answers
453
views
How to convert a bar legend to line legend in chart.js 2.7.2?
I am trying to create a line graph using chart.js v2.7.2 and here is what it looks like:
const labels = [
'January',
'February',
'March',
'April',
'May',
'June',
];
const data = {
...
1
vote
1
answer
1k
views
Resize Chart Independently From Legend in ChartJS for Canvas Download
Some of the charts created and downloaded by my application have the potential to have very large legends. When this is the case, the idea is to create (ideally via ChartJs - as is the case with the ...
0
votes
0
answers
733
views
How can I add legends to different map layers in Mapbox GL JS?
I am building a web map with multiple toggleable layers using Mapbox GL JS. The web map contains 3 separate parts:
Map layers (Mapbox tilesets)
Legends
Pop-ups
There are two legends built using HTML/...
0
votes
3
answers
589
views
How to compare numbers correctly in JavaScript
I want to compare 2 values based on which I get the color for my legend. But unfortunately I cannot use ceil, floor or round the values as it will effect my result.
I have following color table with ...
0
votes
1
answer
89
views
Issue with displaying correct domain values in legend tick
I am working on continuous color legend using d3.interpolateViridis. I have problem in displaying the legend tick values. I want to display my min(at one end) and max(at another end) (domain values) ...
0
votes
1
answer
4k
views
ChartJS custom legend doughnut separate legend from chart area
I'm attempting to separate the Legend from my Chart in a ChartJS chart.
When using the 'default' legend, there is no way to control the chart area size and it will get smaller the more items I have in ...
1
vote
2
answers
438
views
Display legend of grouped data (different colors) in chart
I have a horizontal chart with different colors to group the data. In the code below, the chart layout displays as intended, but the legend shows only a single color (yellow). How can I force the ...
0
votes
1
answer
25
views
ChartJs doesn't display the line item legend
Here's the code:
And here's the result:
As you can see, no legend
1
vote
0
answers
178
views
Why does my D3 legend color ramp replace my second legends colors when I remove it in react?
I am creating a React application and have a component that creates D3 legends for every layer I have selected. When I have multiple legends showing and one gets deselected, the remaining legend has ...
0
votes
1
answer
252
views
Load Tooltip faster during onHover of Legend Doughnut chart
I currently have an implementation exactly like the answer shown in this answer which I am going to include here for clarity. If you run the code and hover between items in the legend, you will notice ...
0
votes
1
answer
374
views
Highcharts Legend issue: I Wanted to make Legend 100% width and text center align it works fine in crome but it is not aligned center in firefox
try https://jsfiddle.net/74cgu6pm/7 on both crome and firefox you will get to know the issue.legend: { width:'100%' },
0
votes
1
answer
137
views
Highcharts - Heatmap - Legend remove white "dashes"
I need to remove all of these white lines from the heatmap legend. Does anyone know how I can edit these?
Rendered Chart
Design I'm trying to achieve
0
votes
1
answer
2k
views
How do I create a legend in Google Maps API?
I am using a very long GEOJSON file with 172 point features. I have classified them using 7 categories and trying to create a legend with the resulting data. I have gotten a few errors that I can't ...