How would one implement a star-rating feature like this in GWT? Does a library exist?
Main scenario: display a decimal rating as partially filled stars.
A call to server returns a [0, 5] decimal rating/grade, say 3.4.
UI display 3.4/5 filled stars, something looking like this .
By default, the best approach I can think of would be to create a number of small pre-filled images in a client bundle with a given rating resolution, say 0.5 (~ 10 images) or 0.1 (~ 50) images. And then write the mapping logic to display the appropriate star-filled image.
Is is the most efficient way of going about it?
A perhaps optimized version of this approach would be to have images of one partially filled star and then the display logic would assembled the 5 stars as function of rating -- e.g., for 3.4, 3 fully filled stars, one partially filled star to 0.4 level, one empty star.
Complement scenario: enter an integer rating {0, 1, 2, 3, 4, 5} stars.
Display five void stars.
When user mouse over a star, the star and all stars to the left fill up.
When user click, integer rating is registered.
Using a similar approach as above, two-images would suffice: one with no background, one filled.
Again, is there a widget/library out there wrapping such a common web-app feature?
It does not seem difficult to implement but no need to re-invent the wheel! A good library of such a common web-app feature could have more embedded functions like managing the rating list by rating and their corresponding display, entering review panel, etc, all performance optimized.
Create three star images: complete, empty and half-full.
Create a custom widget. Use FlowPanel as a container with star images inside.
Create method showRating() in this widget:
(a) Clear stars if you already had them.
(b) Add complete star images for each round point.
(c) Add half-empty star image for half-point, if necessary.
(d) Add empty star images if necessary to make 5 stars in total.
It's a fairly simply widget. You don't need a library for that.
Related
I'm looking to create a packed bubble graph like the below (size of the bubble corresponds to population, and the color of the bubble corresponds to number of widgets sales). The graph is exactly the way I need it, except that I would like to arrange the countries so that they are grouped by continent. Is there a way to do this in Tableau?
I've tried to recreate a similar scenario even though it's not clear if the bubble color should (or not) be related to a specific field.
That being said, using the superstore dataset, I've "grouped" customers by region (color) so they are some how aligned through inner circles.
In order to do so, I just sorted the region pillow in the detail section.
See below.
Microsoft Form Recognizer - Need assistance with building a custom model that recognizes and extracts oval filled form responses. The form has a series of questions with five possible responses that are presented as fillable ovals horizontally displayed next each question. The first oval should be filled if the responder "Strongly Disagrees" (A), the second oval should be filled if he or she "Disagrees" (B), the third oval "Uncertain" (C), the fourth oval "Agrees" (D) and finally the fifth oval should be filled if he or she "Strongly Agrees" (E). Is it correct to draw a zone around and designate each fillable oval as a "selection mark" type, labeling and zoning each oval from left to right within the form as 1_A, 1_B, 1_C, 1_D and 1_E (five different recognition zones) for the first questions' five possible responses. 2_A, 2_B, 2_C, 2_D, 2_E (again, five different recognition zones) for second question's five possible responses and so on, including 3_A, 3_B, etc.
Used the Layout pre-built model instead. Works like a charm.
I have a feature layer with points. I have three pages in my print composer. On one of my pages, I only want to show points that fall within a certain value range. First, I tried locking the style on the pages where I want to display all my points.
Then, I went to the Query Builder of the layer I want to select points from, and I created an expression to display only points from a range:
The problem is that this selection modifies the points shown on all my pages in print composer, even the ones where I locked the layers and style for layers. The only alternative solution I can think of is to select the points I want to show, create a new feature layer with those selected points, and then show that feature layer on my page in print composer. However I'd like to know if there's another way to do this without creating a new feature layer each time I want to filter the points I show in print composer.
There's another way. The points change because when you define a query, basically you define what features will be loaded to the project. So if you use categorized symbology you can define that some feature will be not displayed, but they will stay loaded in the project.
Here you can find how to use this type of symbology: Classifying Nominal Data
I am new to NoSQL databases, and even though I've looked for it a lot, I cannot find best practices for this sort of thing.
Backgammon, for those of you who don't know, is a game with a board that has twenty four pips (or slots), and a bar which can contain pieces of any color (pieces which get hit are placed on the bar). Plus, each pip (or slot) can contain one or more pieces of the same color.
The structure I'm looking for should be optimized to help me calculate two things quickly:
Is the move valid? For a move to be valid, the target slot must have less than two pieces of the opposing color. For example, if I want to move to slot 4, and I'm black, slot 4 must either have only 1 white piece (that will get hit after this move), or have no pieces, or have one or more black pieces.
What is every player's pip count? The pip count is the number of dice I must have, in total, to win the game. For this, I need to be able to quickly retrieve the location of pieces of one color all throughout the board. The calculation will be done locally, outside of the database. If you are curious about how the pip count will be calculated after I retrieve the query results, check out Beginner's Guide to Counting Pips.
The structure I thought of is something like this:
{
1: {
color: 'black',
pieces: 2
},
2: {
color: 'white',
pieces: 1
},
3: {}
// etc, until 24
24: {}
bar: {
{
color: 'white',
pieces: 1
}
}
}
The only problem with this approach, as you can no doubt see, is the bar. Since the bar can contain pieces of any color, I had to create another object inside the bar key, so that I could later on add pieces whose color is black if needed.
Is there a better structure? Also, I'd appreciate tips and tricks on how well/awful this structure will perform.
Considering the fact that you have only 1 document with a relative constant size, you can safely assume that this 1 document will be kept in memory, thus you shouldn't worry too much about performance issues more so that it's only one document - it's basically asking how good will my HashMap perform...
If it was up to me, I would split bar into 2 bars - bBar and wBar (as in real life by the way, each player has his own bar next to him to keep his own "eaten" pieces).
By the way, any calculations that involve best moves and such should happen in memory. You should not store intermediate calculation results in the DB
For example 3 columns are there with y axis value as 100,200,300 in barcharts.
User select one column alone and drag it to 500 value in y-axis.
How to achieve this?
Is it available in library like androidplot or aChartPlugin?
If not which plugin support this requirement.Our project is for Android tablets
Please provide me sample code for this requirement.Thanks in advance.
To my knowledge no library exists for Android that provides 'out of the box' capabilities to drag and reorganize data. Having said that, any library that provides you with a way to correlate touch events to data elements and also supports dynamic updates should be suitable.
If you have specific requirements about how the "drag" is implemented then you may end up having to roll your own library or customize an existing one to your needs. If not, here's a basic workflow you could implement with Androidplot that represents the drag operation as a cursor:
1 - Detect selections using an OnTouchListener. Here's an example of a bar plot that allows bar selection via touch. Gives a full example of converting screen coords to model elements etc. Create and add an instance of XValueMarker denoting the current position of the selection. (An XValueMarker is basically a customizable vertical line marking an x-val.
2 - Detect "drag" events using an OnTouchListener. Here's an example that detects zooming and scrolling. It's not the same thing exactly but the scrolling logic is close enough to give you the general idea.
3 - As the user drags, update the position of the XValueMarker by XValueMarker.setValue(Number).
4 - Once the "drag" ends, remove the XValueMarker and modify the underlying XYSeries to reflect the change using basic data structure manipulation(s).
And of course remember to always call plot.redraw() after each operation that is expected to alter the appearance of the plot in some way.