question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

State map labels being used for both axes

See original GitHub issue

I’m not sure if this is happening because I’m doing something wrong or not understanding the intended behaviour. But, when I define a state_map in my graph, I’m seeing mini-graph-card attempt to map both primary and secondary y axes using this map. This leads to a visual bug in how the axes are labelled, and a bunch of warnings thrown in the console.

I’m attempting to graph two sensors. The first is a standard binary sensor, and the second a number between 0-4 inclusive (For context, this is for a smart bassinet. One sensor shows whether the bassinet is on, the second the level of “soothing” it is using). I’ve configured the card like this:

type: 'custom:mini-graph-card'
name: Snoo state
entities:
  - entity: binary_sensor.snoo_asleep
    name: Asleep
    aggregate_func: min
    color: grey
    show_state: true
    show_line: false
    show_points: false
  - entity: sensor.snoo_soothe_level
    name: Soothe level
    show_legend: true
    y_axis: secondary
    aggregate_func: max
lower_bound_secondary: 0
upper_bound_secondary: 4
hours_to_show: 12
points_per_hour: 60
smoothing: false
color_thresholds:
  - color: '#0000ff'
    value: 0
  - color: '#6600cc'
    value: 1
  - color: '#00ff00'
    value: 2
  - color: '#ffff00'
    value: 3
  - color: '#ff0000'
    value: 4
state_map:
  - value: 'off'
    label: Awake
  - value: 'on'
    label: Asleep

What I’m seeing is that values on the secondary Y axis are also being mapped according to the state_map. This can be seen in the Y axis labels, as well as when a point on the graph is selected: Screen Shot 2020-02-18 at 9 49 13 pm

The labels on the secondary Y axes are marked “Asleep” and “4” when they should be “0” and “4”. Additionally, mousing over a 1 point indicates that the Level at that time is “Awake” when it should be “1”.

This can also be seen with the card logging warnings in the console. When points on the graph higher than 1 are moused over, the card logs this:

mini-graph-card:  value [3] not found in state_map mini-graph-card-bundle.js:1:66925
mini-graph-card:  value [4] not found in state_map 2 mini-graph-card-bundle.js:1:66925
mini-graph-card:  value [2] not found in state_map mini-graph-card-bundle.js:1:66925

I think what I’m expecting here is for the card to not look up numeric values in the state map. But, more broadly, would it also be worthwhile making state maps axis-specific?

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:2
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
kalkihcommented, Feb 18, 2020

Hello, Yes this is indeed an issue, I’m leaning towards making it axis specific, started working on just this a few weeks ago: https://github.com/kalkih/mini-graph-card/commit/822d3f529ab76ba58c72916dc3a0041dda8f2a14.

0reactions
jlsjonascommented, Jan 19, 2022

State maps is one of the global items that should be made entity specific so this should be resolved in the 0.12 release (the one after this month’s release)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Labeling and text hierarchy in cartography
The task of 1) selecting fonts and font styles and 2) placing (or, positioning) labels and text on the map is traditionally called...
Read more >
Create Dual-Axis (Layered) Maps in Tableau
This article demonstrates how to create dual axis (layered) maps in Tableau using several examples. A dual-axis map is a map with two...
Read more >
Label your map—ArcGIS Pro | Documentation
In this tutorial, you'll label map layers and work with label properties such as size, color, orientation, and placement. Optionally, you'll use the...
Read more >
Format a Map Chart
Map area - Change the zoom level of the map, ranging from a state/province view all the way to the world view. Map...
Read more >
axesm-Based Maps - MATLAB & Simulink
You can create a map of a region, such as a continent, country, or group of states, using a projection automatically determined to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found