Jfreechart DateAxis should show date on the top of first tick unit - jfreechart

can anyone help me how I could display the date alone on top of the first tick unit of DateAxis in Jfreechart Gantt
Like this:
6july|||7july|||8july|||
valueAxis.setTickUnit(new DateTickUnit(DateTickUnit.HOUR,6));
///what needs to be extended here to get the desired format as said above
valueAxis.setDateFormatOverride(new SimpleDateFormat("'|'d,MMM"));
Thank you.

Because a Gantt chart uses a DateAxis for the range, you can invoke setDateFormatOverride(), as shown here. Of course you'll want to use getRangeAxis().
Addendum: Reading more closely, you can use setLowerMargin() and/or setUpperMargin() on the range axis to leave some room for the date over the end ticks.

Related

Time range bar that looks like line chart or LINE CHART which accpets same data as Time range

Libary which I'm using right now:
-"react-apexcharts": "^1.3.9"
I'm trying to find out you can make time range bar which looks like a basic line chart. I can use basic line chart beacuse they are not accepting start and end in data. So it looks like this :
I want to look it like :
displaying data:
Possible solutions:
1.find option in react-apexchart that changes look of time range bar
2.Find line chart which accpets start and end data

jfreechart control OHLC time series range for dynamic display

Using:
java 17
JavaFX 17
JFreeCharts 1.5.3
JFreeCharts FX 2.0.1
I would like to feed dynamic data to an OHLC plot with OHLCSeries
I used the MaxItemCount but this is only good if all your time series has same dimensions
I need to show some trading signals that is not the same size as the OHLC series so the max item count will not work
Is there a way to show the latest 3 days (or the last 100 Hours) on a mixed series chart?
Using OHLCSeriesCollection for mixing OHLC and indicators (moving average) on the same chart. i.e. they don't happen on all the candle signals.
What if I need to add another TImeSeries (with a line&shape renderer) on the same chart but this one will have fewer items?
Can I use the Axis to control the items displayed by time?
DateAxis dateAxis = new DateAxis("Time");
CombinedDomainXYPlot mainPlot = new CombinedDomainXYPlot(dateAxis);
and adding data
OHLCSeriesCollection candlestickDataset = new OHLCSeriesCollection();
candlestickDataset.addSeries(new OHLCSeries());
TimeSeriesCollection timeSeriesCollection = new TimeSeriesCollection();
timeSeriesCollection.addSeries(new TImeSereis);
I noticed in old versions there was an option to add the TimeUint in the Series constructor. What is the alternative now?
ComparableObjectSeries doesnt have MaxItemAge?
EDIT:
Problem:
I have data with different occurrences over time
Data is TimeSeries & OHLCseries mix on the same chart (different renderers)
Data is dynamic and I would like to display only the last X points in time (3 days for example) i.e. aged are removed

anychart stock - range selection with mm:ss resolution

i'm using anychart stock 8.1.0. I have a dataset with 24 hours of date with per-second resolution. I would like for only a small 30 seconds subset of that data to be shown/zoomed on load.
I could not find out how to do this so i tried adding a range selector option like below but i couldn't get that working either.
rangeSelector.ranges([{
'text': 'Testing',
'startDate': '2006 May 16 13:00:00',
'endDate': '2006 May 16 13:00:30'
}
If i use the range selector slider i can zoom as i require but how do i define this in code ?
So to recap i'd like
have the chart zoomed on load for a specific time range of type
start-stop in format of dd/MM/yyy mm:ss
have range selector button options for various time ranges of same format as above.
thank you.
Yes, you can define your own custom periods for rangeSelector, but if you want to zoom to specific period on load you have to call selectRange() method after chart drawing.
If you want to show only 30 seconds in the beginning of your series you should put the following line into your code:
chart.selectRange("second", 30, "first-date", true);
You can learn more about this method here
And find a similar example of using it here

ShieldUI Stacked Bar Graph with Totals

I've got a stacked bar graph that shows two categories of information. Now I have a requirement to show the total of the bars at the end of the bar. I've attached a mock-up showing what I'm trying to do -- the numbers in red are what I'm trying to add.
(source: michaelandlisa.us)
I couldn't find anything in the documentation on how to add totals, or on how to add annotations (which would also work).
Basically, ShieldUI jQuery chart plugin renders the series without text, as shown here.
To alter this behavior, you need to first enable the text.
Then, you can use a format function to either show some cumulative text, or return an empty string. More information on this approach is available here.
This can be coupled with a global counter to determine each Xth iteration.
I managed to get this to work by adding a Scatter chart of total values on top of the existing bar chart.
http://michaelandlisa.us/Images/Forums/stacked_with_totals_scatter.png
I also set the color on the series to "transparent" so the point wouldn't show up, and then I bumped the X and Y by 15 and 12 respectively. I also set the style to Bold, and set the format to "{point.y:n0}". Here's the relevant MVC code (where totals is a List of object):
.DataSeries(series => series.Scatter()
.Data(totals)
.CollectionAlias("Total")
.Color("transparent")
.AddToLegend(false).DataPointText(dtp =>
{
dtp.Enabled(true);
dtp.Format("{point.y:n0}");
dtp.Style(s => s.FontWeight(FontWeight.Bold));
dtp.Color("red");
dtp.X(15);
dtp.Y(12);
}))

JFreeChart - Vertical Line Chart

HI how to create a chart like http://livedocs.adobe.com/flex/3/html/images/VerticalLine.png. Using XYPlot. Thanks in advance.
Many charts let you specify the PlotOrientation in the corresponding chart factory, but createTimeSeriesChart() is not one of them. As an alternative, you can create your own variation using the source as a guide.
Addendum: As #Gavin comments, PlotOrientation.VERTICAL is the default for `XYPlot, so you'd do something like this (untested):
XYPlot plot = new XYPlot(dataset, timeAxis, valueAxis, null);
plot.setOrientation(PlotOrientation.HORIZONTAL);

Resources