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.

JSON Mock with numeric Funnel.line.dash value

See original GitHub issue

I have the mock funnel_vertical_overlay_custom_arrays.json that sets the line dash to 10. Would I be correct in assuming that a value of "10" is ok (i.e: changing the mock value to string is correct)? For the values 0 to 5 I assume 0 refers to "solid", no? If so I guess the value 10 is incorrect?

Looking at the schema below it seems like this is a candidate for “enumerate”. This would allow the Scala API to set the correct value. I see that issue https://github.com/plotly/plotly.js/issues/2903 has already referred to this possibility. Would it make sense for me to make a request?

TIA.

                "connector": {
                    "line": {
                        "color": {
                            "valType": "color",
                            "role": "style",
                            "editType": "style",
                            "description": "Sets the line color.",
                            "dflt": "#444"
                        },
                        "width": {
                            "valType": "number",
                            "min": 0,
                            "dflt": 2,
                            "role": "style",
                            "editType": "plot",
                            "description": "Sets the line width (in px)."
                        },
                        "dash": {
                            "valType": "string",
                            "values": [
                                "solid",
                                "dot",
                                "dash",
                                "longdash",
                                "dashdot",
                                "longdashdot"
                            ],
                            "dflt": "solid",
                            "role": "style",
                            "editType": "style",
                            "description": "Sets the dash style of lines. Set to a dash type string (*solid*, *dot*, *dash*, *longdash*, *dashdot*, or *longdashdot*) or a dash length list in px (eg *5px,10px,2px,2px*)."
                        },
                        "editType": "plot",
                        "role": "object"
                    },

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
alexcjohnsoncommented, Mar 30, 2020

Also that mock has marker.line.dash which is not supported, we should remove that from the mock. So this is just about connector.line.dash.

The key part of the attribute description is “or a dash length list in px (eg *5px,10px,2px,2px*)” - That’s a freeform string - following a pattern, but not enumerable. But we list values in the schema because these are special values that are interpreted dynamically. Aside from solid, these do not have a fixed representation as dash length lists, as we scale the dash lengths with line width.

Side note: according to the docs you actually should not use “px” in the attribute as we suggest in the description, though AFAIK browsers universally accept it that way.

10 is coerced to "10" and then interpreted by stroke-dasharray as “10px on, 10px off.” 0 ends up solid, but only because the browser doesn’t know what to do with “0px on, 0px off”, not because we assign values to the special strings.

0reactions
hmfcommented, Mar 30, 2020

My JS knowledge is next to 0 and getting to know Plotly.js code is not doable. I have already bitten off more than I can chew on this Scala wrapper thingy. Went down this rabbit hole thinking I would have it done in a couple of weeks. 8-( I will change the mock to string and hold off on the validation. Thanks for everyone’s help.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Mocking API with JSON Server - YouTube
Today I am learning how to mock a JSON API with the JSON server NPM package.- JSON Server https://www.npmjs.com/package/ json -server- Link to ......
Read more >
Data – amCharts 4 Documentation
Data items are in correct place, but the line seems buggy. ... For a Pie chart series, it might be numeric value and...
Read more >
How to Fake or Mock an API with JSON Server - Atomic Spin
JSON Server is an easy-to-use module for mocking an API for most of your API needs, including custom routes, POST routes, and faking...
Read more >
plotly.js-basic-dist-min | Yarn - Package Manager
... with values colorscales [#4444]; Fix inside text fitting for bar , funnel and ... attributes: minzoom , maxzoom , line.dash and symbol.placement...
Read more >
Corticon.js Rule Modeling
iMail, InstaRelinker, JustAssembly, JustDecompile, JustMock, KendoReact, ... of dashes), or none of the rule cell values for a condition row ...
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