In Workshop: How can I create buttons (functions?) so that user can segment by day, week, month or year - palantir-foundry

Background
I've read about Typescript, but I am not a developer, so I am interested in how can I learn how can I create useful functions in Workshop.
Question 1
How can I create buttons (functions?) so that I can create buttons for users to select segment by day, week, month or year?

You could use Functions to do that but you can also do it directly in workshop with a combination of button + tabbed section.
Indeed:
you create a button (like a Menu button for instance) where you list all the options (Day, Week, Year).
Then you create a tabbed section with as many tabs as they are choices
For each tab you create the chart you want to show, segmented by either day / month / year etc
You hide the header of the section (not to see the tab labels anymore)
In the button, you add to every single choice an event "Switch to ... Tab X)
The downside of this is obviously that you'll need to maintain many charts and thus it is more painful if you have one thing to change on the chart (the color etc...) as you'll need to do it several times.
Hope it can help you if you want to explore non-technical ways of achieving the above.
Maxime

Related

How do I insert free text/arrows into a bar chart in Contour to identify specific events that happened on a specific date?

I have a bar chart with exact dates over several years (ex: January 1st, 2016 to February 30th, 2019) on the x-axis and the number of events per day on the y-axis (ex: number of gatherings). On this bar chart, I am trying to also indicate certain dates on which some type of change occurred (ex: a fair opened causing an increase in events). I want to be able to indicate this either with a colored line on the bar chart and a legend on the side explaining the change corresponding with that color (ex: purple line marked on January 3rd, 2016. legend shows purple line with explanation: "fair opened") or an arrow marking that date with the text relating to that event (ex: "fair opened" with arrow pointing to/from January 3rd, 2016). I'm not sure how to go about doing this (would this require uploading a dataset into contour?). I'm pretty new to Contour, so any help is appreciated!
In general, Foundry is quite strongly opinionated that things should be backed by "data", so if you want to keep track of and display events in your charts, you'll want a dataset holding your event data.
The quickest way to go about this would be to create a new Fusion sheet and sync a table region to a dataset. You can then copy/paste or simply manually enter data into the spreadsheet and it will update the related dataset. In Contour, you can then add an Overlay to your existing chart and point it to the dataset holding your events. If you make this a scatterplot layer, you can, for example get a circle drawn on the chart where each event takes place.
There is much more robust support for timeseries and event type data once your data is incorporated into the Ontology layer, where you can use Quiver and Vertex for more complex visual analysis and dashboard building. If you're just interested to explore these features of the platform, check out the first few courses in the APPDEV series which will introduce you to the Ontology layer and the basics of Quiver.
You can't have an arrow or free text overlaying your chart in contour.
However you could have another chart line layered with the first one that just overlaps and highlights the section you want. That layer will have its own legend, so it would have a similar effect.

Google sheets dropdown lists that update as options get seleected

Hi all I’m just starting to look at google forms and sheets.
I’m wanting to create a form to vote for players in a team.
I dont want to use the multiple choice style of question, I want to use dropdown lists.
I’d like 3-5 dropdowns eg: “3 Votes”, “2 Votes”, “1 Vote”, “1 Vote”, “1 Vote”. All of these dropdown lists draw from the one sheet with the team members and would all have the same 20 odd names displayed on activation.
However, when a player is selected in “3votes” it would not appear in “2votes” or “1vote” dropdown lists, and so on, as players are selected in the 2vote and 1vote lists.
The intent is to remove the opportunity to vote for a player more than once
The form will be used by a number of people that could vote the same way,so it’s not like removing appointment options for everyone, just what the form can select as it’s being used
I can do it with multi choice radio buttons without any scripting, but it’s not very elegant esp on a phone.
I image this is a relatively simple script, but I have no idea about JavaScript or gs.
Thanks for help in advance
Eddie

How to make html selection with independent two columns?

I want to make a 'year' and 'month' selection on the mobile web using HTML selection list with independent 2 columns. Selection one doesn't affect the other selection like iPhone alarm setting.
Also, I want to make a drop-down using one click (etc. I don't want to let the people click twice to open each year and month selection.)
I've searched google and I couldn't find the answer. Anyone would help? Thank you very much!!

UiApp cache vertical panel

Developing small app to record a set of 6 readings for monitoring purposes in 31 rooms. App will have two main views, one view to show list of buttons for each room where readings will be taken, a second view where the values will be entered for a particular room and then posted to a spreadsheet.
The process in mind here is click on button for a particular room, enter the data, return to button view to choose another room to enter the data for that room and then back to button view screen.
Since the button view will seldom change do I have any options for caching this view so that I do not have to run a function to rebuild it each time. I have this function
function createTGSRoomListButtons(sh, aData){}
That takes the list of rooms and builds a panel of buttons for selecting the different rooms.
The question that I have can the above function be run once to cobble together the UI, cached and the later simply be 'recalled'?
TO that some end the view where the data will be entered can this be partially cached so that with each rendering a reference to a specific room can be made.
New to Google Apps Script so not really sure how to properly determine my answer.
You can have multiple panels in an UI and play with visibility to show one or another... no need to cache any content since they remain unchanged in the process.
If I understood your use case well, the panel with specific room info would be modified according to spreadsheet data so in this case you won't need to cache values since they would be "reconstructed" each time. The trick to show/hide panel has been shown in this post with clientHandlersand multiple panels in a unique vertical panel to ensure that the visible panel is always at the right place.
A very simple way would be build the UI for the first time and then hide/unhide the buttons' panel each time using the setVisible() method of the panel

QWidget or just paintings?

I work on a Qt4 calendar custom widget and in month view (a grid of more or less 30 cells/days), in each day's cell, I want to draw events of the day like this:
start hour - title
start hour - title
start hour - title
(...)
So, just a vertical list of events, with HTML formatting.
I'd like to offer the possibility to move events betweens cells with drag'n'drop.
So, I don't know if I must create a QWidget for each cell with QLabels inside or if I can render html on those cells and manage drag'n'drop in a other way...
If you want to, you could manage drag and drop yourself by checking which item was clicked on when the drag started, and putting the appropriate data into the drag events. However, I think your first option sounds easier, at least until you come across other requirements that makes it not work.