Newbie formatting dygraphs fail - formatting

I am using arris-capture which makes use of dygraphs for displaying data. The author has kindly provided example data files and an index.html but it is very basic. I have two questions:
1) When I mouse-over any of the graphs, the popup is not formatted nicely. I cannot post an example image because this is my first post. How can I modify the index.html to display the popup that isn't a run on sentence?
I think it would look nicer like this:
2013/08/12 18:24:01
Downstream 1: value
Downstream 2: value
Downstream 3: value
Downstream 4: value
Downstream 5: value
Downstream 6: value
Downstream 7: value
Downstream 8: value
2) The plots included are pretty basic. I would be very interested to see how some of your dygraph wizards might modify them to be more visually pleasing.
Thank you!

There are plenty of things you can do to format the legend.
Check out the documentation here.
To get the legend onto separate lines, use labelsSeparateLines.
To put the legend somewhere else entirely, use labelsDiv.
To completely change the style of the legend, use labelsDivStyles

Related

IllegalArgumentException: offset(41) is out of bounds [0, 24] for TextField with custom VisualTransformation

I have a raw string which is like this:
#[{user-356,nam}] #[{user-356,tran}] ()($($ vhv #[{user-356,five}]
And it should be edited in realtime but also have to be displayed like a normal text which is:
nam tran ()($($ vhv five
which have 3 clickable part in the "#" format.
So I used a custom VisualTransformation to transform the cursor indexes from raw one to the displayed one. It worked just fine when just tapping a single cursor (Which mean TextRange .start and .end is the same). But it crashes when I long click to show a ranged selection. The short crash log is below (indexes are for the raw string above)
java.lang.IllegalArgumentException: offset(41) is out of bounds [0,
24]
at androidx.compose.ui.text.MultiParagraph.requireIndexInRangeInclusiveEnd(MultiParagraph.kt:754)
at androidx.compose.ui.text.MultiParagraph.getCursorRect(MultiParagraph.kt:603)
at androidx.compose.ui.text.TextLayoutResult.getCursorRect(TextLayoutResult.kt:529)
So indexes 41 should be the index of the raw string. But indexes [0,24] should be the transformed one. No idea why it uses the wrong indexes for the wrong string. Debugging with breakpoints shows correct calculations when mapping offset. I don't know where this crash comes from. It feels like there is some mis-functioning with the lifecycle of the variable passed into the TextField
I have created a working project here https://github.com/tranhoainam/jetpack-textfield-crash-test
Forgive me for the messy code, I'm just copy it from every class in my project. Any suggestion would be appreciated. It took me a week to try to debug this problem.
Thank you for your time.

Tabulator - formatting print and PDF output

I am a relatively new user of Tabulator so please forgive me if I am asking anything that, perhaps, should be obvious.
I have a Tabulator report that I am able to print and create as a PDF, but the report's formatting (as shown on the screen) is not used in either output.
For printing I have used printAsHtml and printStyled=true, but this doesn't produce a printout that matches what is on the screen. I have formatted number fields (with comma separators) and these are showing correctly, but the number columns should be right-aligned but all of the columns appear as left-aligned.
I am also using Tree View where the tree rows are coloured differently to the main table, but when I print the report with a tree open it colours the whole table with the tree colours and not just the tree.
For the PDF none of the Tabulator formatting is being used. I've looked for anything similar to the printStyled option, but I can't see anything. I've also looked at the autoTable option, but I am struggling to find what to use.
I want to format the print and PDF outputs so that they look as close to the screen representation as possible.
Is there anywhere I could look that would provide examples of how to achieve the above? The Tabulator documentation is very good, but the provided examples don't appear to explain what I am trying to do.
Perhaps there are there CSS classes that I am missing or even mis-using? I have tried including .tabulator-print-table in my CSS, but I am probably not using it correctly. I also couldn't find anything equivalent for producing PDFs. Some examples would help immensely.
Thank you in advance for any advice or assistance.
Formatting is deliberately not included in these, below i will outline why:
Downloaders
Downloaded files do not contain formatted data, only the raw data, this is because a lot of the formatters create visual elements (progress bar, star formatter etc) that cannot be replicated sensibly in downloaded files.
If you want to change the format of data in the download you will need to use an accessor, the accessorDownload option is the one you want to use in this case. The accessors transform the data as it is leaving the table.
For instance we could create an accessor that prepended "Mr " to the front of every name in a column:
var mrAccessor= function(value, data, type, params, column, row){
return "Mr " + value;
}
Assign it to a columns definition:
{title:"Name", field:"name", accessorDownload:mrAccessor}
Printing
Printing also does not include the formatters, this is because when you print a Tabulator table, the whole table is actually rebuilt as a standard HTML table, which allows the printer to work out how to layout everything across multiple pages with column headers etc. The downside of this is that it is only loosely styled like a Tabulator and so formatted contents generated inside Tabulator cells will likely break when added to a normal td element.
For this reason there is also a accessorPrint option that works in the same way as the download accessor but for printing.
If you want to use the same accessor for both occasions, you can assign the function once to the accessor option and it will be applied in both instances.
Checkout the Accessor Documentation for full details.

How to save variables from Uppaal created during the modeling process

I've created a model with Uppaal in which several integer variables change over the course of time. Now I would like to save the values of the variables during the modelling process somewhere (best in xml or a text file). In the Uppaal documentation (https://www.it.uu.se/research/group/darts/uppaal/documentation.shtml) I found the method in point 13 (How do I export and interpret the traces from Uppaal?) and tried the Java API way already, in the hope that it can output the variables as well as the traces. Unfortunately this method seems to be limited to traces. Does anyone know a method to save the variable values from Uppaal?
Hopeful greetings,
Josi
Solution from the comments.
to export the variable value tractory over time, one may use SMC query in the verifier.
For example:
Typeset the following query: simulate 1 [<=300] { Gate.len }
Click Check
Right-click on the query, and from the popup menu choose Simulations (1)
Observe a new window popup with a plot
Right-click on the plot and choose Export Comma Separated Values
Follow the save file dialog and observe the resulting file to contain time and value sequence.
Note that SMC assumes that all channels are broadcast and there are no deadlocks.

Flow aligned right

In my QML file, I'm using a Flow type. I want the items put in the Flow to be aligned right, but Flow normally aligns from left to right, as in this picture:
The Flow type provides an option to change layout direction, layoutDirection: Qt.RightToLeft, but in this case the order of the items will be wrong: first line will show 2 1 0, second line: 4 3, third line 6 5.
There doesn't seem to be an option in the Flow type to keep flowing the items LTR but align them right.
I've been first trying to replace the Flow with Column and Row types handling the positioning logic myself but it became ugly.
Now I'm thinking about extending the original Flow object to add an extra option. I'm considering taking the Flow source code and tweak it to make my own ExtendedFlow type.
Is there an easier/cleaner way to achieve this? What would be your suggestions?
I would have wrote this as a comment, if stackoverflow didn't restrict me from commenting on question for not having a reputation of atleast 50 points.
I can see an answer in your question. You said "The Flow type provides an option to change layout direction, layoutDirection: Qt.RightToLeft, but in this case the order of the items will be wrong: first line will show 2 1 0"
(If your program logic allows you to do this way)Why not Change layoutDiretion: Qt.RightToLeft and then change the order of your itemsto 2,1,0 so that they will be shown as 0,1,2.
This is much simpler and quicker than taking the Flow source code and tweak it to make your own ExtendedFlow type.

Extracting Data from an Area file

I am trying to extract information at a specific location (lat,lon) from different satellite images. These images are were given to me in the AREA format and I cooked up a simple jython script to extract temperature values like so.
While the script works, here is small snippet from it that prints out the data value at a point.
from edu.wisc.ssec.mcidas import AreaFile as af
url="adde://localhost/imagedata?&PORT=8113&COMPRESS=gzip&USER=idv&PROJ=0& VERSION=1&DEBUG=false&TRACE=0&GROUP=FL&DESCRIPTOR=8712C574&BAND=2&LATLON=29.7276 -85.0274 E&PLACE=ULEFT&SIZE=1 1&UNIT=TEMP&MAG=1 1&SPAC=4&NAV=X&AUX=YES&DOC=X&DAY=2012002 2012002&TIME=&POS=0&TRACK=0"
a=af(url);
value=a.getData();
print value
array([[I, [array([I, [array('i', [2826, 2833, 2841, 2853])])])
So what does this mean?
Please excuse me if the question seems trivial, while I am comfortable with python I am really new to dealing with scientific data.
Note
Here is a link to the entire script.
After asking around, I found out that the Area objects returns data in multiples of four. So the very first value is what I am looking for.
Grabbing the value is as simple as :
ar[0][0][0]