I need to customize colors for charts, but if I try to use a formula the color is not shown in the preview of the report.
The formula result is an integer number, and if I put directly the integer it works.
Attached some image to better explain it
Summarizing if I use a formula the color is not shown in the report preview, but if I insert the integer number that is the same obtained from the formula it works.
What I’m doing wrong?
In this case, the behaviour is by design and is intended. With List & Label, formulas are only evaluated at runtime, as dependencies etc. can also exist here. Fixed values, on the other hand, can be displayed in the preview of the Chart Properties dialogue as described by you.
Is the formula evaluated correctly when printing the report in the preview for example?
in my database I have data like:
- Description1, Color1
- Description2, Color2
- Description3, Color3
The description is shown on Y axis, and the idea is to set the line color, for the Description, as the Color associated (that is in integer format, eg. Purple = -1749820)
I set in Fixed Color the formula for getting the related color of a Descriprion
In the Designer is shown Purple color, but in the preview I see it black
Within internal tests (using List & Label 29), we set the formula as follows:
We have a formula that returns the desired colour. The colour is then applied to the diagram during a preview print. As already mentioned, you cannot see the set colour in the chart properties dialogue of the diagram, as it is only evaluated at runtime.
How exactly does your self-created designer function
ConvertHexColorToDecimal() work? What type of value does
I have attached an example, which can be opened with the help of our demo application “DemoApplication29.exe” via “Reports”. You will find the demo application in your List & Label installation directory, in the “Samples” subfolder.
Charts with report parameters.srt (30.2 KB)
Could you adjust the sample so that we can reproduce the problem?
Consider that I’m using L&L 28, taking data directly from a database.
Report_PerfusionDataChartView.Color is a string containing the integer for the color like “16769611”
I’m not using now the function “ConvertHexColorToDecimal” just to simplify, but the result is the same
My database is like:
Tha table name is “Report_PerfusionDataChartView” and I have
- “Report_PerfusionDataChartView.TimeStamp” on X axis
- “Report_PerfusionDataChartView.Description” on Y axis
- “Report_PerfusionDataChartView.Value” on Z axis
On Fixed Colors page I added
- Condition: Report_PerfusionDataChartView.Description == “Art_press”
- Fromula: val(Report_PerfusionDataChartView.Color)
But the preview shows
If I set the integer value 16769611 in the Fixed Colors
Then it works
What I cannot understand is that it seems the formula is correclty evaluated and the number for the color is the same (16769611) because the “val(ReportChart.Color)” is the integer for the color.
Hope this can help on your investigation
The value of the evaluated formula within any Designer Preview could show an expected value. But at printing-time the whole data source is come into account and the real data seems differently then.
From the current point of view, your way should be able to solve the requirement as we could not reproduce it on our end with simple samples as you could see. Therefore we assume something with the used data went be wrong and two points need to be checked for that now:
- be sure all records of the data-table has got a valid color-value at the data-column “Color” - no NULL-value, empty string or 0
- als be sure, that all values for data-column “Color” have the same value for the “Description” of “Art_press” - just the first value is used/evaluated
If all of these points looks as expected we need the used report-file and data-source at our end to be able to reproduce it and try to find the cause and a possible solution for your requirements. For this please try to provide a small sample and create a ticket at our Support-Center.