i very new with Vaadin.
i have a chart with bars veritcally.
i want to geht horizontal bars
i have read here:
https://vaadin.com/docs/v8/charts/java-api/charts-charttypes.html
thats a part of my source (no errors):
Chart chart = new Chart(ChartType.BAR);
Configuration configuration = junkPerMachineChart.getConfiguration();
configuration.getChart().setType(ChartType.BAR);
configuration.addSeries(series);
junkPerMachineChart.setCaption("Stündlicher Verbrauch Mischer");
getUI().access(() -> junkPerMachineChart.drawChart());
i searched inside my junkPerMachineChart for a method like
.setType(ChartType.Vertical);
there is no option like this.
i also searched inside the configuration and found no method like this:
i changed ChartType to COLUMN and the bars are now horizontal
Configuration conf = junkPerMachineChart.getConfiguration();
conf.getChart().setType(ChartType.COLUMN);
Related
I want to put the same legend top center of the chart. Legend items will be dynamic, likes sometimes 2,5 or 9, etc.
So, it should take space dynamically like how it is acting on the bottom.
I tried with inset functionality but it seems this is not looking better like the bottom one.
and there are few more complexity like I want it like a flat, so now if I define step size 3 then maybe, for now, it looks good for 9 items. but when there will be 2 items, it will show as a list!!
Although I solved that problem through the following solution:
// get parent elements
let parentEle = d3.selectAll("#chartID svg");
let childrenEle = parentEle
//Convert selection to selection representing the children
.selectAll(function () { return this.childNodes; })
.filter('g');
// putting legends position on TOP
d3.select(childrenEle._groups[0][2]).attr('transform', 'translate(0, 5)');
you have to keep eye on chart width - height and according to this, you may have to control padding in TOP for the chart.
might be this is not a good solution but it works fine for me :D
Can't figure out how I change the text colour of tooltips. For my column chart I tried:
series.tooltip.label.fill = am4core.color("#FFFFFF");
But it doesnt work. Curious also how I do it for the pie charts? Is there one place that I can update to affect all chart types, or do each need to be handled independently?
The tooltip label gets a calculated color that contrasts with the tooltip background. You need to set autoTextColor to false in order to the fill color to take effect.
series.tooltip.autoTextColor = false;
series.tooltip.label.fill = am4core.color("#FFFFFF");
The same is valid for pie charts.
You can create your own theme but that could be more than what you need.
You can use more than one theme, which allows you to use one default theme and then override just what you need:
am4core.useTheme(am4themes_animated);
am4core.useTheme(function customTheme (object) {
// Identify the instances
if (object instanceof am4core.Tooltip && object.label) {
object.autoTextColor = false;
object.label.fill = am4core.color("#FFFFFF");
}
});
After a lengthy search, I got the Below Line of code as successful line
pieSeries.labels.template.fill = am4core.color("white");
I have added above line of code if you are using axis range you can use that however as I can see your problem please take a look below line of code will solve your problem
series.tooltip.getFillFromObject = false;
series.tooltip.label.propertyFields.fill = "color";
series.tooltip.background.propertyFields.stroke = "color";
https://www.amcharts.com/docs/v4/concepts/tooltips/
How do I create a stacked JqPlotBar chart in Tapestry? This is what I have tried.
List<TextValueDataItem> list1 = CollectionFactory.newList();
List<List<TextValueDataItem>> dataList = CollectionFactory.newList();
list1.add(new TextValueDataItem("Test1", 50));
list1.add(new TextValueDataItem("Test1", 60));
dataList.add(list1);
return dataList;
The result I get is a bar chart with one color until 60, with points label at 50 and 60. There is also no legend.
Any help would be much appreciated. Thanks.
There is now an example of stacked bar chart at https://github.com/got5/tapestry5-jqPlot.
I have a problem when trying to package the project using maven mvn package. It is trying to search for files under folder org\got5\tapestry5\jquery\jqplot\jquery\jqplot_core\jquery\jqplot\v1_0_8 but the folder in your tapestry-jqplot jar file is capital V1_0_8. You need to change it to small letter v1_0_8 for the jar file to work.
What are the properties that control the width of the X-axis labels on a horizontal bar RadChart? Here's what it looks like now:
I need the labels on the left to be wider.
I actually, just needed to keep the auto layout doing its thing, and disable auto wrapping this way:
var item = new ChartAxisItem();
item.Appearance.RotationAngle = AutoTextWrap.False
I've a Highstock chart (Line with markers and shadow) and would like to show a highstock tooltip programmatically, i.e. when i select, for example, a row on some table (that contains chart data) i would like to show the corresponding highstock tooltip.
Is that possible?
For StockChart this solution doesn't work:
In this example you have to replace this:
chart.tooltip.refresh(chart.series[0].data[i]);
to this:
chart.tooltip.refresh([chart.series[0].points[i]]);
The solution is available here.
If what you want is to trigger tooltip on the plot near ith data point, then probaly you can use this answer, which suggest to do something like
chart.series[0].data[i].setState('hover');
where chart is the result of your new Highcharts.Chart. (jsfiddle from the comments to that answer).
I guess that if you want to do it on <tr> click, than your js could finally look like this
var chart = new Highcharts.Chart({ <your options> });
$('#yourTableId tr').click(function(){
var i = $(this).index(); // `this` points to <tr>, get its index
chart.series[0].data[i].setState('hover');
});