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);
Related
I'm new to D3, NVD3 and Angular-NVD3. I need to create a chart that looks similar to this, using Angular-NVD3:
SO question: NVD3 Stacked Bar Chart Plus Line Overlapped
(there's a JS Fiddle on the SO question).
Angular-NVD3 has two charts which each accomplish most of what I need, but not all of it:
Those would be the MultiBar and the MultiChart. (http://krispo.github.io/angular-nvd3/#/quickstart)
Examples:
That is, I need a stacked bar chart with a line (or lines) overlaid on top of the bar chart. I believe that to do this, one must use a "multiChart" instead of "multiBar" chart. (Please correct me if I'm wrong).
The SO example above modifies the NVD3 library, which I would like to avoid. After researching, I can see why they chose this approach.
nv.d3.js (version 1.8.2), for the multiChart object, Lines 9068-9069 :
bars1 = nv.models.multiBar().stacked(false).yScale(yScale1),
bars2 = nv.models.multiBar().stacked(false).yScale(yScale2),
If you change these lines to .stacked(true), it does stack the bars.
How can I use Angular-NVD3 and accomplish what I need without changing the library?
Ideally the solution would be pure configuration. The next most ideal situation would be to set the "stacked" value at runtime from inside my enclosing component, but I can't seem to get access to the object.
I would like to avoid a highly intricate solution if possible because the whole point of these abstractions is to avoid such complexities. However, all solutions are welcome.
I found the answer:
you can change the stacked value in the callback() event handler, specified in your config:
chart: {
type: 'multiChart',
...
callback: function (chart) {
chart.bars1.stacked(true);
chart.bars2.stacked(true);
chart.update();
},
...
}
};
Use multiChart. To get the bars side by side set yAxis: 1 on both bar data sets.
https://github.com/novus/nvd3/blob/master/examples/multiChart.html
(the repo examples cover more then the website)
I want to add two or more timeSeries in order to generate stacked line graph.
I could not find something in the API. I am trying to do it manually but still does not work as I want.
Is there any function in the API, or not, that could manage this?
Thanks
Well this worked ^^
rtp: RegulatTimePeriod instance.
As iterating through the datasets of the two series we use this code to add a new node if there is not a record for the current rtp or udate the existing by the sum of the values.
if(StackedSerie.getValue(rtp)!=null){ //stacked lines dataset
StackedSerie.addOrUpdate(rtp,(double)((float)v + StackedSerie.getValue(rtp).floatValue()));
}
else
{
StackedSerie.add(rtp,v);
}
I'm tring to override CreateLabels to insert labels or text in specific points in plotter chart but I need a help in:
1. what does the parameter (ITicksInfo<double> ticksInfo) mean and what should I send to it
2. how to use the return value to add labels to already defined Axis like _stringaxis.LabelProvider
or if there is simpler way to add text in a point please tell,
Many thanks.
Just found the easiest way to add a nice label inside the chart.
CenteredTextMarker label = new CenteredTextMarker();
label.Text = text;
//just dawing a line with one dot tall in the same position you want the label to be
plotter.AddLineGraph(compositeDataSource1,
dptLine,
label,
new PenDescription(ComponentName));
and I'm Hiding the legend and build a customized one my self by doing
plotter.LegendVisible = false;
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.
I am using a jfreechart to show a line graph. I want to use same graph to show another line graph. Can anyone tell me how to do that?
Thanks in advance
JFreeChart chart = ... //Get the chart with your first dataset.
CategoryPlot plot = chart.getCategoryPlot();
plot.setDataset(1, anotherDataset); //The '1' at the first parameter is
//the index of dataset.
//Thus, '1' for the second dataset.
... //some other settings to the plot, with index=1.
plot.setRenderer(1, someRenderer);
Then we can get the graph with this chart.