Primefaces lineChart - Limit the number of x-labels - jsf

In a JSF webpage, I display a line chart thanks to Primefaces.
Each point corresponds to a date for abscissa and his value. Problem is when I start to display too much points, all x-labels (dates) are printed and user is unable to read them.
Is there a way to limit the number of labels printed to avoid labels overlays?

Primefaces axis labels are determined by the ChartModel backing them. So to manage your situation
Limit the entries in the LineChartModel to a manageable number
Increase the size of your chart as a whole, using it's width and height css values under the style attributes
Use the max X or max Y to restrict value displayed on the corresponding axes

Related

How to configure chart.js line chart with very low minimum height, and only 0 and 1 (no decimals) as ticks on the y-axis

I'm trying to tailor the chart above to take up as little vertical space as possible. It is a line chart showing binary data (1 or 0 for door open or closed), but it seems to force me to have the decimal ticks between the two values, even thought every point's y-axis value is 1 or 0 as integers. Ideally it would be no taller than the width of the y-axis label.
Is this possible? I've tried various things to do with the container, removing y-axis ticks etc, but I'm struggling to get it more compact than this.
UPDATE:
I've managed to get rid of the decimal ticks with config from these docs. Still no luck on the height...is there an undocumented minimum or something?
Per this question, the answer is to set a fixed height on the chart canvas.
Fix the height of Y-Axis of Bar chart in chart.js?

Maximum dataset size for Chart.js

I've got a hidden field that contains the values of dataset. Whith Chart.js I read the hidden field and then I plot the graph.
I've got 2 questions:
Which is the maximum number of values that a scatter graph can display?
Consider a dataset with thousands values (> 100.000) that can't be rendered with one load becouse dataset is too big to be stored in a hidden field. Is there a way to fragment the dataset in part and render only if user demand it (like a scrollbar and load the first half by default and if moved to load the second half)?

flot: zero values are displayed on the axis

One of my line charts contain values in the range 0..11.5
flot is using yaxis with 0..12
the problem: value 0 is drawn on the axis (see attached image)
Is there a way to tell flot to add a small margin, e.g. use 0.5 margin?
or - Is there a way to get the min and max values, so I manually can set xmin and xmax?
There is the autoscaleMargin option for the axis which does what you want. Or you can set min and max values for the axis manually.
The default for autoscaleMargin on the y-axis is 0.02 (you can see that the points are not completely on the axis but slighty above). Increase this to your liking.

Box plot with labels and axes, fitted to a div with fixed dimensions

Following the provided example I built a function that draws a box plot to a jQuery accordion tab, which has a certain fixed height & width. The amount of distinct categories varies greatly depending on the incoming data. Currently I'd like to achieve the following in the plotting:
1) Add axes and display labels, like in this picture
2) Always fit the boxes to container width and height. Currently I see that if there are too many categories, some of them end on the second row, ensuring they're not fully seen. In the picture, the div contains 7 boxes but only 4 fit on one row:
The question is how can these two be implemented? I couldn't even figure out a way to reliably reduce the padding between the boxes without eating into the side numbers on the boxes.
I adopted the original d3.js example to include axes:
http://bl.ocks.org/jensgrubert/7789216
Instead of using individual svg elements as in Mike's implementation, here all boxplots are rendered with in one root element. This makes it easy to add axes.
Best,
Jens
For the time being I'm using a hack found at Highcharts forum (jsfiddle here). There's also a box plot implementation made with Raphael.js that looks cool (github, example)

Which is the best way to plot graph in iphone?

I saw some Core-plot sample. Is there anything equivalent that will do my task easily? I also want to know feasibility with Core-plot in iPhone. (any issues with core-plot)
I want to have multi-colored vertical bar chart. Is it possible to customize Core-plot framework. Using only one barplot can we have multiple segment on it.
Thank you.
Naveen Thunga
To make a stacked bar plot, you need to make multiple plots, one for each segment. On all but the bottom plot, set barBasesVary to YES. The datasource will ask for a third field called CPTBarPlotFieldBarBase which is the base value for the bar. You will have to do the stacking calculations yourself.
The horizontal lines can be drawn using an additional bar plot. Give the bars a short height (tip - base). You can make the width wider than the others if you want--each plot is independent.
The space between the bars depends on several factors. By default, bar widths are specified in data coordinates. For example, if the bar locations are one unit apart, a bar width of 0.5 will make the bar width and the space between the bars equal; a bar width of 0.75 will make the space 1/3 of the bar width. The actual width in pixels depends on the size of the graph and how many bars are visible (determined by the plot range along that axis). If barWidthsAreInViewCoordinates is YES, then bar widths are given in pixels which keeps them the same apparent width as the plot range changes, but the space between them will change with the plot range.

Resources