Jasperreports: how to set axis interval? - jasper-reports

I've got a simple task at hand: to plot integer-integer value pairs using line chart or XY chart or whatever using bean type of datasource. The bean in question returns long value both for X and Y axis. The default behavior one would expect is to show ticks of 1, 2, 3, 4, etc. on both axis.
But no, I get values like 2.5 or 1E1 for the same application running on two different machines! OK, this old post suggests to set tickLabelMask to "#". Now integers are indeed displayed, but with repeating values, like 0, 0, 1, 2, 2, 3, 3, 3, 3, 4, 4, etc. The same post suggests I add two properties to my report,
net.sf.jasperreports.chart.domain.axis.tick.interval
net.sf.jasperreports.chart.range.axis.tick.interval
Unfortunately, these have no effect when added at report level in JRXML file. When I try to add them at chart level between <reportElement ..> tags, Jaspersoft Studio removes them once I save the file. So, I take it , something has changed.
So, how could I fix this issue?
I'm using Jaspersoft Studio 6.9.0 and Jasperreports 6.6.0

Nowadays it's done using "Chart customizers". General info can be found here. To put it short, in design view select the chart, go to Properties window, select "Chart" there, scroll down to "Chart customizers" section, click "Add", and the choose range and tick customizer.
Additional artifact must be included into your project: jasperreports-chart-customizers

Related

AEM 6.4 [coral-3] – Toggle dialog fields based on dropdown selection - Doesn’t work for multiple values

In AEM 6.4 [coral-3], we could implement toggling of dialog fields based on the dropdown selection by adding granite:data node and granite:class. But this works only for single value. How to make it work for multiple values. For example, if a dropdown has three values [x, y, z] then I would like to show "text1" if we select x OR y and would like to show "text2" if we select z. I have tried making showhidetargetvalue to String[] with multiple values [x, y], but it didn’t work. Any reference will be helpful.
The default implementation of showhidetargetvalue doesn't support multiple values, the code for the default implementation of this feature can be found in:
/libs/cq/gui/components/authoring/dialog/dropdownshowhide/clientlibs/dropdownshowhide.js
unfortunately you will have to create a customised version of this script to support it.

iText 7.1, C# - How to set table width to span the entire page?

I'm using iText 7(.1) with C#. I have a table with data. I want the table to take up the full width. How do I do that?
The example code in the jumpstart tutorial, that is:
var table = new Table(new float[]{4, 1, 3, 4, 3, 3, 3, 3, 1});
table.SetWidthPercent(100);
doesn't quite work for some reason -- Visual Studio will complain that Table doesn't contain a definition for SetWidthPercent().
You should use:
table.SetWidth(UnitValue.createPercentValue(100));
The setWidthPercent() method is the method, you'd use in iText 7.0, but this changed in 7.1.

All my fields are tabindex=-1 in my editview

I've created a custom module based on people template.
i've customised the editView (which is synced with the detailView) and I have assigned a tabindex value for every field.
But when I use that editView almost every field has tabindex=-1 so I only can't get to them using my mouse, which is very slow.
I was changing include/EditView/EditView.tpl but it looks the changes there has no effect on the generated code.
I changed all tabindex=$tabindex for a tabindex="-3", "-4", "5" in every tabindex assignment, but I couldn't see it in my html page, I also tried making a QRR previously.
So my question is where can I fix that -1 issue or, at least, where is really being generated my editView.
Thanks in advance!!!
Well! I found a workaround... I guessed that the problem was the autogenerated fields, they had no "space" among another fields's tabindex values...
So, instead of giving the fields tabindex values of 1, 2, 3, 4... I gave them as 10, 20, 30, 40...
And, against all odds, it works!
Perhaps it's useful for somebody....
Well, I finally found where this fields, and tabindex values of course, were generated.
The include/EditView/EditView.tpl has been overwritten by the themes/suiteP/include/EditView/EditView.tpl.
This SmartyTemplate calls tab_panel_content.tpl in the same folder... Well, as I'm using SuitePImproved this wasn't true, suitePImproved/include/EditView/EditView.tpl was loading suiteP/include/EditView/tab_panel_content.tpl so that had to be fixed.
Anyway, in the tab_panel_content.tpl file you find tabindex=$tabindex 4 times, that $tabindexare replaced by:
$subfields.tabindex
$colData.field.tabindex
$colData.field.tabindex
$colData.field.tabindex
And this is working everywhere for me.
This change is not upgrade-safe because I didn't get loaded that tpl from the custom/themes... I'll come back later to fix that

How do I generate multiple pages Box [1,2,3...] of [X]

I have a box label form and it all works great but we would like to be able to automatically generate sequential box labels. So on the form we would have a [Total Boxes] form field. If the user put in "5" then on the labels we would generate a different label for each box e.g. 1 of 5, 2 of 5, 3 of 5, 4 of 5, 5 of 5. I would be happy with this happening at the time they are printed, or generating a new PDF with all the pages. Either way this needs to be a very simple process for the end user of the forms. Any ideas?
I never found a perfect solution to this in Acrobat. I decided to simply recreate the form in Excel and lock the sheet except for the fields needed and then it was easy to create multiple pages.

How do I write a Prometheus query that returns the value of a label?

I'm making a Grafana dashboard and want a panel that reports the latest version of our app. The version is reported as a label in the app_version (say) metric like so:
app_version_updated{instance="eu99",version="1.5.0-abcdefg"}
I've tried a number of Prometheus queries to extract the version label as a string from the latest member of this time series, to no effect.
For example, the query
count(app_version_updated) by (version)
returns a {version="1.5.0-abcdefg"} element with a value of 1. When put in a Grafana dashboard in a single value panel, this doesn't display the version string but instead the count value (1).
How can I construct a Prometheus query that returns the version string?
My answer tries to elaborate on Carl's answer. I assume that the GUI layout may have changed a little since 2016, so it took me while to find the "name" option.
Assuming you have a metric as follows:
# HELP db2_prometheus_adapter_info Information on the state of the DB2-Prometheus-Adapter
# TYPE db2_prometheus_adapter_info gauge
db2_prometheus_adapter_info{app_state="UP") 1.0
and you would like to show the value of the label app_state.
Follow these steps:
Create a "SingleStat" visualization.
Go to the "Queries" tab:
Enter the name (here db2_prometheus_adapter_info) of the metric.
Enter the label name as the legend using the {{[LABEL]}} notation (here {{app_state}}).
Activate the "instant" option.
Go to the "Visualization" tab:
Choose the value "Name" under "Value - Stat".
Note on the "Instant" setting: This setting switches from a range query to a simplified query only returning the most recent value of the metric (also see What does the "instant" checkbox in grafana graphs based on prometheus do?). If not activated, the panel will show an error as soon as there is more than one distinct value for the label in the history of the metric. For a "normal" metric you would remedy this by choosing "current" in the "Value - Stat" option. But doing so here prevents your label value to be shown.
We recently added support for displaying the serie name as a value in the single stat panel (https://github.com/grafana/grafana/issues/4740). So you have to run our nightly build until we release 4.0.
Just make sure the query returns one serie and you can use the "name" value in the dropdown under Options -> big value.Then you can format the string using the legend formater. Ex {{job}} would return "node" as a serie name.
I hope this answers your question.
While most of #marcus-rickert's answer is still valid in Grafana 7, there is some change.
The 'Stat' 'Name' field seems to be gone, instead in the 'Field' panel, you can set the 'Display name' to the label you want to show.
This worked for me.
label_values(my_metric{type= "xxx", another_label="xxx"},target_label)
With Stat visualization in Grafana 8+, you can set the legend to the intended label name and then change the Stat Styles -> Text Mode to Name
Prometheus doesn't have any functions that return strings, what you're looking for is for a Grafana singlestat to be able to display a label value - which it unfortunately doesn't support yet.
https://github.com/grafana/grafana/issues/5094 tracks this.
Another update on very latest kube-prometheus-stack using grafana 8.0.3. I still faced this issue, for me in a Bar gauge I still had this issue in scenarios where it only returned 1 value, but with 2+ values the Legend field works OK.
My solution:
Go to Edit Panel, find Display Name, type
${__field.labels.insertYourLegendValueHere}
I wanted to get all the various values of a label from Prometheus to put into a variable in Grafana. I used this simple query to populate my varialbe Drop-Down list:
label_values(myLabelName)
This returned the expected "value01", "value02" etc