How to change widget data source dynamically, with click action on another widget - dynamic

I have a line chart and 3 simple card widgets on the same page/state of a dashboard.
Each card shows a different telemetry reading (but all readings are from the same asset, they are not different devices because they all come from the same box with multiple sensors).
I would like the chart to change the data source depending on the card I click on (like when you navigate to a different state)
I know that actions/states work with entities, but I don't know if they work with readings.
Also, I would like to have all this on the same page, instead of navigating to a different page, that is what usually happens when you navigate to a different state.
Is this possible?

Related

Track clicks on a button based on preceding button clicks

I need to track clicks on a button at the end of a sequence of selections. As shown in the image, there are five different business plans (circled in red), and each plan can be for three different years (highlighted in blue). The user will checkbox a business plan type (e.g., market trend) and click a year (e.g., 2017), then click the PDF button (highlighted in black) to download that particular plan (market trend for 2017 in this case).
So instead of counting the total clicks of PDF downloads, the task is to count how many times a particular plan is downloaded based on the plan type and year.
The PDF button, the checkbox for each plan type, and the click button for each year all can be tracked individually. They are also all on the same URL.
GTM and GA are used for tracking. Can anyone share some thoughts of how to achieve this type of tracking?
Thanks!
Yao
If you are using google tag manager you can use dataLayer.push() to push to an array which can be used to differentiate the clicks based on the interaction.
Approach is described here
Google Analytics custom dimensions
In your particular case you could have the dataLayer configured to add the different key / values for the different report components and then the trigger will be configured to fire when the download button is clicked.
For example on each of the check boxes you could have:
<input type="checkbox" onclick="dataLayer.push({'plan_component': 'Market Trends'});">
You'd probably better having an array to store this info.
The resultant data can be viewed or aggregated via a custom report download. Described here.
Custom Dimensions and Metrics
It can be a bit tricky to understand and you'll need to change the site so that the dataLayer gets populated with the requisite data but this is the way to go. Best of luck.

Posting Panels Twice (Understanding pre-init)

I have a page that dynamically builds a group of Panels based on a SQL call.
Here is an example of what I am trying to accomplish.
When the page is first loaded several Panels are dynamically built. Lets say there is one panel for each State: CA, NJ, FL, etc.
If a user clicks on one of the panels (ie. one of the states) a SQL call is made and brings back a list of cities within that state. The page then dynamically builds the panels only this time listing the cities within the state clicked. When the user clicks on of the cities it calls SQL and find all of the schools listed in that city and displays them in panels (again one school per panel).
What's Happening
When the states are loaded they display fine. Though when the user clicks a particular state the page reloads and then displays all of states and all of the cities after listing all of the states instead of just listing the cities.
The proper cities are being listed so the SQL call is working.
Solution
I know several things.
ViewState is remembering the panels previously created and loading them
or
When I step through the code it's loading both the states and then the cities.
Dynamic controls are handed during the pre-init stage of the life-cycle.
Question
How can I solve this problem? I didn't post any relevant code because there is a decent amount of it to sift though. If parts of it are needed / wanted ask and I can edit this post.
I have already searched though Microsoft's documentation and the like so please don't post links to those unless you are fairly certain they will help with the issue.

Positioning Dynamically created buttons

I am creating a program which creates a number of different buttons depending on how many entries are in an access database, the buttons are creating fine however they are not being positioned correctly, is there an easy way to govern where they will be positioned ?
The buttons are going to be used to send a string of information to the COM port the string will vary depending on which button is pressed as each button has a name on it that has been taken from the database.
they need to be arranged like a table 7 by 4 however the issue i am having is that i cannot make the button go onto the next line when the previous line is full

how can i do this in wp7?

Any ideas on how i can create this app?
1) i have a page which contains 3 tasks and thus has a textbox, a label to contain an image name and another label which is to display my current location..the first is to enter some text into a textbox, the second is to take a picture and come back to this page and display the picture url and the 3rd is to determine and display my location.
2) i need to gather each of these 3 bits of information and upload it to a remote database via WCF or Odata.
3) I know that for example, to either take a picture with my camera or browse to a pix in the pictures hub will take me away from my task page.
how can i take the picture and carry the information back to my task page without losing state?
To get a picture from the camera you need to use a CameraCaptureTask.
To choose an existing picture from the phone you shoudl use a PhotoChooserTask.
To get the devices currentl location use the GeoCoordinateWatcher.
There should be no issues with loosing state while you capture this information but isf there is you can just store it in the Page State object.
Note. All links are "How To" articles.
When you take a picture, your application will be tombstoned. See the following article for details of how this process works and what you need to do:
http://windowsteamblog.com/windows_phone/b/wpdev/archive/2010/07/20/understanding-the-windows-phone-application-execution-model-tombstoning-launcher-and-more-part-3.aspx

Connecting two DialogBoxes in GWT

In my GWT project, I'm trying to get it so two DialogBoxes can pass information between each other. One of them holds a MapWidget, and when a button is pressed in the other DialogBox, the position information is received from that other DialogBox's MapWidget. Does anyone have any tips for how I should coordinate between having two different DialogBoxes show up? Should I wrap the code for the two in a Composite? Furthermore, is there an example anywhere of dealing with two DialogBoxes at once in GWT? For example, if I click outside of the two boxes, both should be dismissed. I'm wondering if there's a way to keep both of them in focus at once, so I can switch between the two without causing either to disappear.
Sharing Data Between Dialog Boxes
In my opinion, the "correct" way to do this would be to implement some sort of MVP structure in the application so that a presenter manages the view (DialogBoxes, among other things) and knows how to pass simple data to the view for it to display (the presenter would handle the MapWidget data, the view would take care of displaying it on the DOM).
However, if you're looking for a quicker/more simpler approach, you have a couple of options (which you choose really depends on the application structure):
Create a Composite, as you mentioned, that knows how to pass the necessary data back and forth. By having the Composite manage the data object and tell the two DialogBoxes how to display it, you are actually approaching an MVP architecture within your Composite.
Subclass DialogBox into a class that contains a HandlerManager (sometimes used as an "Event Bus") that fires events when the button is pressed. You can create events that are designed to pass data back and forth between the two DialogBoxes (even make them type-safe with type parameters). See this StackOverflow question for details on using a HandlerManager. The MVP article, linked above, also has some good information on using an event bus.
Model-View-Presenter is a tried-and-true method of structuring an application that results in more testable code, better project structure, and can help guide you when making decisions like this. I strongly recommend checking it out if you haven't already.
Sharing Auto-Hide Functionality
GWT's PopupPanel (on which DialogBox is based) offers a method addAutoHidePartner(Element) which is describe thusly:
Mouse events that occur within an autoHide partner will not hide a panel set to autoHide.
So, you can create two auto-hiding DialogBoxes that only close when you click outside both of them (e.g., they do not close when you click within either of the boxes) with the following code:
// Create the dialog boxes
DialogBox dbox1 = new DialogBox(true, false);
DialogBox dbox2 = new DialogBox(true, false);
// Set some visual options
dbox1.setPopupPosition(10, 10);
dbox2.setPopupPosition(200, 10);
dbox1.setAnimationEnabled(true);
dbox2.setAnimationEnabled(false);
// Set the dialog boxes' caption and content
dbox1.setHTML("Dialog Box 1");
dbox2.setHTML("Dialog Box 2");
dbox1.setWidget(new HTML("This is the first dialog box."));
dbox2.setWidget(new HTML("This is the second dialog box."));
// Making dobx2 a partner of dbox1 means clicking
// in dbox2 won't cause dbox1 to close
dbox1.addAutoHidePartner(dbox2.getElement());
// Similarly, setting dbox1 as a partner of dbox2 means
// clicking in dbox1 won't cause dbox2 to close
dbox2.addAutoHidePartner(dbox1.getElement());
// Show the dialog boxes
dbox1.show();
dbox2.show();
You can interact with either of the dialog boxes without the other closing. Omit the appropriate call to setAutoHidePartner if you only want a one-way partnership.