I would like to know if is possible to customize the column width of a bar graph.
Regards
Franco
Short answer, yes, see this, you should be able to customize everything in Live-Charts, by default MaxColumnWidth property is 35px, this means the bar will be capped at 35 px, no matter if there is more available space, if you change this property your bars will grow, mySeries.MaxColumnWidth = double.PositiveInfinity;
Playing with the column properties you can practically achieve any effect:
But it is a bit more complicated than that, bars will only have a greater width if there is enough space to grow, the width of any bar (ColumnSeries, RowSeries, StackedRow and StackedColumn), do always have a width of 1 chart unit, this because as you can notice the chart scales no matter what values you give to it, the next diagram explains a bit how it works:
For a bar series, the available space of a bar changes according to the number of visible bars:
You can only customize the max value, never the minimum dimension, in both previous cases the column width was capped by the MaxColumnWidth property, but notice when there are many bars, column's width needs to be less than 35px to be displayed correctly.
Related
I'm using ChartJS to display multiple charts on a page.
Each chart has a different dataset, and different labels (some have short labels, some have long labels).
Currently the width of the actual 'data-part' (the part of the chart showing e.g. Bars) depends on how much space the labels take. I would like to make all charts have a fixed size for the data-part, and let the labels take up the remaining size.
See for example the following screenshot. Here I display 2 charts, but the actual data-part is different for both, because one has shorter labels than the other.
What I would like is to set for example a fixed width of 400px for the data-part, and let the labels take the remaining space left on the page. That way the charts would be aligned perfectly above each other.
Even better would be if I could set that for each chart the data-part takes a percentage of the width (e.g. 70%), so the labels take the rest (30%).
I have checked the ChartJS documentation, but the only I can find it setting the width for the entire chart-component.
Cheeky solution - you can add a dummy chart before your charts having the same labels.
Let's call this dummy chart as chart D and your main chart as chart M.
In M, you would fix it's width and hide the labels by writing in options -
scales: {y: {ticks: {display: false}}}
Now you have a fixed data width.
In D, you would just display the labels and hide the data part (hiding grid lines, legend, title, etc.).
So now you have two charts side-by-side, one is displaying just the labels and the other displaying the bars, just need to position it in such a way that no matter how long the label is, it does not overlap with M. Repeat the step similarly for all charts and have the same width for M1,M2,M3,...
This is a solution that seemed to work for me.
I need to create a Container with a layout of two rows, the second one twice the height of the first, and put the container in the south position of a BorderLayout. I tried to do this using a TableLayout with two rows and one column, setting the height percentages to 33 and 67, respectively. However the TableLayout filled the entire screen, not just the "South" area. The javadocs indicate that the height percentage refers to the "parent", which I assumed would be the container with the TableLayout. But, apparently, the parent in question will be the display.
My next attempt was to create a TableLayout with three rows and one column, giving the lower content a vertical span of 2. But the bottom rows just disappeared.
Is there a solution I overlooked?
There are two separate stages in layout, requesting the preferred size and dealing with assigned size.
During the request stage we don't have the final size of everything so this is "guesstimated" (which amazingly my spell checker didn't flag?).
As we do the layout we already have an assigned size based on that preferred size and then the percentage is calculated based on that assigned size.
If you place a table layout container in the center of a border layout it will get all available space and so the preferred size aspect of the calculation phase will become meaningless and then percentage will be of the space allocated to the component which is "all available space". Naturally scrolling brings this into a completely different dimension.
I want to autosize the grid columns to max size of the content. How do i do this. i see only autoSize function on grid column, not sure how to use it.Say column header width is more then the column data width, that should be used.
I have used autosize function, It works, but i have few issues, I have to define the align property i.e text fields will be left and number fields will be on right, then heading text gets cut. I have locked columns in all reports, locked section gives some empty spaces.
https://fiddle.sencha.com/#fiddle/1cr6
See column selling code. Its not showing full because of align: Right property. If you remove it will work.
2.After DOW column empty space is coming.
Without minWidth Property columns wont scale properly.
Take a look at this piece of documentation: Ext.grid.column.Column - Setting sizes. I don't think you can make columns scale to content. You can, however, set fixed sizes or make them flex.
I hope this helps.
When adding an indicator to a report as per the image, is it possible to have all the indicators the same size regardless of the cell size (so centre them all rather than stretching to fill the cell)
Use rectangles within the cells of the table: within these, objects can be easily sized to not take full height or width.
Yes, sizing the rectangles and their contents can be annoying. I don't try to do much of this with the mouse, I quickly fall back to the properties window where I can type position and size.
try clicking on the indicator area (default name ie GaugeReportItem) within GaugePanel. You will get Size and position in Properties on the right hand side where you can choose AutoLayout. This will in effect center and resize gauges based on the cell width, height and your settings.
Hope it helps.
Exporting SSRS report to Excel did not go as expected.
Report with indicators in rectangles exported to Excel was randomly adding 0 height rows between the records which was not what I wanted. My indicators where simple green ticks and red crosses, based on true false. I have tried everything I found out there, even a subreport for indicator. No luck...
Figured it out that the indicators randomly outgrows the parent item when you export it, just like a chart. Ended up with saving a tick and a cross as an image. Then used an image control(with fit proportional set) and embedded Image with conditional statement to pick specific image. Also added some padding not to overlap borders.
The only problem I could think of is if the background of the report is not white as I could not change the background color of the cell the Image is and there is no option for the Image background.
Hope this helps someone else.
Is there a good way to limit the Auto Width of an element or Grid Column?
I want to limit the Auto Width only, but allow any user changes.
For example, I want to allow GridSplitter to arbitrarily resize the column, but the initial (Auto) Width should not exceed a specific value. Same for the elements -- I want to allow resizing, but limit the Width they have if never resized.
MaxWidth works exactly as opposite -- it does not affect Auto Width of Grid Columns (it might be a bug), but limits the resized width.
Is there any good solution that works for (almost) any element or Grid part?
Try binding the MaxWidth to the Width and use a IValueConverter to react to changes from Auto to specific values.
In the grid column set the width you want the column to start at. Any changes to the column width made by the user using the grid splitter will overwrite the width you start with.