So I have a table with two columns: location name and coordinates.
I created a map visualization using the coordinates and, of course, the labels on the side menu are the coordinates (as you can see in the pic below).
Is there any way to change those labels, so that the corresponding location names appear instead of the coordinates?
Thanks for the help!
To get what you want add the Location Name to the map as a dimension (instead of the coordinates) and then under Location on that map layer select the Coordinates field (it will by default use the Location Name so change this).
If you want to simplify this you can use tags in your script to say that the Coordinates field is the location data for the Location Name. You can read more about that here, but for example:
TAG FIELD [LocationName] WITH '$geoname', '$relates_Coordinates';
TAG FIELD [Coordinates] WITH '$geopoint', '$relates_LocationName';
This should then mean that when you add LocationName to a map it will automatically know to use the Coordinates to plot the location rather than LocationName.
Related
Lost as I can be on how to control hover text with embedded data.
Non-dataframe scenario
In one case, I am passing a list of dicts to a plotly express (scatter) plot, having the shape:
list[dict[str, float]]
and I would like the hover text for each point to include its key from the dict inside my own domain-specific phrasing for the hover text.
When not tampering with the hover text, the default hover text showing up includes the key following the string "variable", and the x and y values being called "index" and "value" accordingly there in the default hover text. Obviously the x value is just the index of the dict from the list for input shaped as in my input type.
But incorporating these values with names bearing the semantics of the data seems to pose a challenge, as including something like follows does not really plug in (by substitution) anything but the x and y values in the percent prefix bracelets:
fig.update(data=[{'hovertemplate': 'distance: %{y} (class %{variable})'}])
For example, %{variable} will show as just the string as is, it will not substitute this string with the value of what the default hover text calls "variable".
How would I incorporate the "variable" value, as called in the default hover text, in my own hover text specification?
I went through numerous documentation pages where this is accomplished via plotly's non-express api or other ways which didn't seem to work for me. It's in general elusive to adapt any of the dataframe based solutions to my dataframe-sidestepping case. I wonder if there's an idiomatic way.
DataFrame based scenario
In another case, switching to dataframe input, I still battle to get the desired column name be recognized as, I wander in the plurality of ways to handle hover text and data for plotly:
fig = px.scatter(df, x='x', y='distance', color='class')
fig.update(data=[{'hovertemplate': 'distance: %{y} class %{class}'}])
fig.show()
― %{class} in the above dataframe oriented approach, is obviously not the proper way to select the class column's value for the hover data. How would I bring in the value of the desired dataframe column name into the hover text?
I have attached a picture of what I have tried.
Starting from an array with values to graph and another array with the names of these values, I would want to graph them all. For later, from the front panel, I want to be able to choose which ones I want to visualize and which not. In the attached image is what I have tried and it does not work only know how to graph the 1 value with the first name but not the others.
The property you need for setting the names is "Active Plot".
The key to writing multiple plots is the "Bundle" node (or "Bundle By Name").
Result:
I want to use a WKInterfaceButton for my watch app, that looks like the buttons in the watch settings:
with two main attributes:
It should contain a small image on the left
its title should be aligned to the left
I didn't found any possibility to align the title of a button to the left. I already tried to use a group instead (then it would work), but when I use a group I can't use the the shape of WKInterfaceButton.
Here's how I would do it...
Create a button
Make that button type a group
Within that button-group, place two groups inside it. The group on the left will contain the image. The group on the right will contain a label
So place an image in the left group, and a label in the right group.
Adjust the margins, length, heights of these groups until you get the desired look.
Give the button-group a length relative to container of "1" and a height of "size to fit content"
For the inner group that will contain the image, give it a length of relative to container of "0.2" (maybe)
For the inner group on the right that will contain the label, give it a length of relative to container of "0.8" (so that together the two groups make 1)
Give both groups a height of relative to container (1)
use WKInterfaceButton Content as Group and place image and label in it.
While i haven't tried this myself i think what you're looking for to match the watch settings is a table view. Define a table view in the interface controller of your story board and add your image and label to the row(s). There's an example of how to do this in the programming guide for apple kit.
I would like to enter the city name in the UISearchBar,then the map will jump to the current city.
How to do it?
You would need some kind of NSDictionary which would contain all of the city names with their map references (lat/long) maybe this could be integrated with google maps or some other mapping software. Otherwise you will need to attain or build the dictionary manually. Once you have the map reference you could scroll the map to the right location.
In my example I have a table where each row is a user for example. Columns could include their name, address, email address, etc. I now need to add a column for (hypothetical example) their cat's names. While most people will have no cats and some people will have 1- 2 cats there will be the occasional person with 20 cats that create one very long row in the table. This is giving me an issue in presentation and for filtering/searching for cat names. Is there a good solution to displaying this type of data?
Have the first 50 (or whatever) characters of the field displayed as normal then put the rest in a block with its visibility set to hidden through CSS. Include a link / button / icon that will allow the user to toggle the visibility so they can see the entire value.
Several options:
Set a maximum width for the cell and allow the data to wrap
Place the content inside a wrapper tag (such as a div) and set the div with a fixed width/height and style of overflow:hidden to ensure that a particularly long word doesn't force out the width of the cell.
Truncate the output text on the server side
For cases #2 and #3, set the Title attribute of the TD tag to contain the full non-truncated text. This will present itself as a tooltip when hovering over the cell.
I would mention other CSS-based solutions but they're very sparsely supported right now, so not worth mentioning.
You might want to try doing something like what SO does. Namely, once someone reaches a certain point in their Rep, it suffixes the number and appromixates it. Ex. 10k instead of 10,236.
That way the numbers don't get out of hand.