AmCharts4: amCore.percent() not working as intended - amcharts4

I have the following graph:
"1" is a LineSeries, and "2" is a columnSeries. I set the width of the columnSeries like this:
series.columns.template.width = am4core.percent(90);
But as you can see, the columns are far away from 90% width.
Interestingly, without the LineSeries, it looks like this, which is what I want it to look like:
Furthermore, if I write a very high value (80 000) instead of 90, I get the desired columns:
I noticed that the dateAxis behaves differently(different time showing), but I cannot see where this is coming from.
Also, this high value for percentage is not a solution, because it has different widths on different graphs

So after experimenting I found out that the only way to avoid something like this is to use an own dateaxis for columns.
If, for example, you want a line+column, you can add a dateAxis to the line, and a dateAxis to the column.
If you have multiple columns, you could either use one dateAxis for all of them, or give one to every single column. The latter will make the columns "stack", so they are on the exact same positions if one would use the same dates for both datasets.
Furthermore, doing so means that you have to disable labeling on all dateaxes except for one, otherwise the labels on the xAxis will stack.

Related

Conditional Formatting Depending Upon Multiple Numbers

I have a column of values that are a number out of 10. So, it could be 2/10, 3/10, 4/10 and so on, all the way up to 10/10. To be clear, these are not dates, but simply showing how many questions the student answered correctly out of 10.
I'm trying to use conditional formatting to highlight them a certain color depending upon the score they got. For 9/10 and 10/10, I'm wanting to use a certain color, but it doesn't seem to be working with REGEXMATCH or with OR. Also wanting to highlight all scores that are 6/10 or lower. I know that I could make this work by applying conditional formatting for each and every score with text contains but the problem I'm finding is that it thinks it's a date.
Is there a way to match multiple scores out of 10 using REGEXMATCH?
Link to Sheet
select column and change formatting to Plain text
now you can use formula like:
=REGEXMATCH(A1; "^9|10\/")

How to apply conditional formatting (if cell is in another range) to a range of cells

So I have searched through several different questions related to this. None of them seem to be asking exactly what I'm looking for and none of the solutions I've found have worked for me thus far.
I have several columns of data (Player names) where each column's values are generated from a formula in the 2nd row of that column. The 1st row is a header (Game name). This whole range is the collection of which players are willing to play which games. These are columns D-J(ish, the list is dynamically generated with another formula, based on form responses)
I have another range of data where the 1st column is the Player and the 2nd is the player's PREFERRED game. This data is also generated with a formula based on form responses. These are columns A-B.
Here's what I'm trying to do
Using conditional formatting in columns D-J, I want to highlight the player's name if this game (in row 1 of this column) is their preferred game (range A2:B).
I've tried several different variations of VLOOKUPS, MATCHES, and FILTERS in the conditional formatting, but so far nothing has worked. The problem I run into every time is that I can't figure out how to reference the cell that the formatting is applying to, but still have it reference each individual cell over the whole range.
I know I could do this if I applied an individual conditional formatting to each individual cell. However that is a very time consuming and inelegant solution to this issue considering I'm expecting my data range to be much larger in the future. I need a conditional formatting formula that will work across the whole range or , at the very least, for an entire column.
This is a mock of what I'm trying to accomplish:
This is a link to a mock of my sheet so that you can clearly see the data layout and specific formulas I'm using:
https://docs.google.com/spreadsheets/d/1wy1T6dWJwNC_EfdCAbkuxtkJH7y4Cg3x4IyEk6R567M/edit?usp=sharing
use:
=REGEXMATCH(D3, TEXTJOIN("|", 1, FILTER($A$3:$A, $B$3:$B=D$2)))

Iterate through all cells in a column instead of checking all cells individually

I have a simple list with labels and values in a Google Spreadsheet. Below, I have some fields in which I would like to get the value when writing the label.
For example, if I write D in a cell, I want the next cell to show 4, the value corresponding to D.
This can of course be done with repetitive IFs inside IFs inside IFs... in cell B8, like this:
=IF(A8=A1;B1; IF(A8=A2;B2; IF(A8=A3;B3; IF(A8=A4;B4; IF(A8=A5;B5;0)))))
This simply checks row by row: If the written value matches the label of row 1, then show the value. If not, then perform a new IF command on the second row. Etc.
With many rows this is quite tedious. Is it possible in Google Spreadsheets to simplify this a bit? For instance, can I in some way collect all cells in a column in one IF statement by doing A1:A5 or something like that? Something along the lines of:
=IF(A8=A1:A5;B1:B5;0)
solve it by using simple VLOOKUP:
=VLOOKUP(A8, A1:B5, 2, 0)

Horizontal stretching in ListRenderer

I have a list that should display 7 items that each look like this:
Date Weekday Distance Time
Long text that may span many lines
two column text Distance Time
two column text Distance Time
two column text Distance Time
The last lines repeat in a number depending on the data, i e there may be different amounts of such lines for each list item.
I have tried implementing this with a ListCellRenderer that creates a table according to the requirements above, but I have a few problems with it:
The long text that may span many lines is implemented in a SpanLabel. But this text will not display more than one line anyway
Each item in the list will get space for the same number of lines below the first two..
So it seems that items in a list must be of the same size.
Later I also want to be able to detect selection on the entire list item, not just individual fields of it.
Is there a better way to do this?
How do I ensure that the SpanLabel actually gets as much space as it needs?
How do I ensure that the unknown number of lines gets the space they need, depending on how many they are?
Don't use a list: https://www.codenameone.com/blog/deeper-in-the-renderer.html
Lists in Codename One assume every entry is exactly the same height and provide no flexibility here.
I suggest doing something like the property cross demo: https://www.udemy.com/learn-mobile-programming-by-example-with-codename-one/
Where we use a Container with components within to provide a list like behavior with the full flexibility that arbitrary components allow.

How to create Google Chart with lines (series) of different lengths?

How do I create a Google Line Chart that displays two or more lines, with a different number of data points in each series?
For instance, I want to create a chart with 2 lines, one showing the expected values over time and another showing the actual values over time. The date range and expected values are known in advance so I can fully graph them, but the actual values may not be fully known yet (e.g. the date range covers some dates in the future).
I found the answer in this SO question. The solution is to use "_" (or "__", depending on the encoding of the data values) to indicate "no value".
For instance, one data series might be 10,7,3,1 and the other might be 10,6,_,_.