Add a data row in google charts after rendering - charts

Is it possible to add a line into a Line Chart after the Chart has been loaded? Something like
chart.addRows(...)
I want to add those new lines after clicking a dom element.

Yes, and then you have to redraw your chart to update in accordance to your changes.

Related

Is it possible to hide/show line chart with a toggle button in VizFrame

Apologies in advance, I cannot share the code. I do have a screenshot.
[Screenshot][1]
I am using VizFrame vizType 'combination' which is a combination of columns and lines. I want to be able to hide/show just the line charts for the user to have an option. I have looked everywhere but cannot find a way. All I am able to do is hide data point labels which is not my requirement.
But please let me know if this is possible? If so, how can I can hide/show a line chart on click of a toggle button I have in my toolbar.
I'm using ui5 version 1.52
I'm afraid that if you cannot find a way to do that it means that it's not possible with the standard version of the control.
You have two options:
Extend the current VizFrame control you're using in order to
override/implement what you need
Use a third-party control to
display charts. I would recommend you to check out my implementation
of openui5-chartjs

How to set legend position to center in VizFrame column charts in SAP UI5?

I have created a column chart using Vizframe in SAP UI5 using JS View. My requirement is to change the default position of legend from right hand side to the bottom.
I found that "sap.viz.ui5.types.legend.Common_position.bottom" could be used previously but it's deprecated now.
Is there another way to achieve this functionality?
At present you can do it by changing css, Use this class to do that
.v-m-legends{
}
or change transform property position

How to position legend chart labels?

Is it possible to change the default positions of the legend labels around the jasper reports charts? Currently I have a following kind of chart being created:
I would like to move this [hoursNormal, hoursTravel, hoursOvertime]-box from under the chart to the right side of the chart. Another thing I would like to do is to replace this [hoursNormal, hoursTravel, hoursOvertime]-box by label "month". I just don't see any tools for moving these positions in Jasper studio chart creation wizard, and to me also the xml looks like so static that I don't believe tinkering it would help me.
Hopefully I'm wrong and there is a easy solution?
Move the legend to the right and other option of the chart can be find in the Properties View.
Click the chart, to view Properties for the chart. Navigate the different properties tabs to set what you need.
Example
If you need more advanced feature on the chart you need to use a customizer class see this as example: How to put benchmark line on barchart?

How may I force a redraw of all Vaadin charts in a dashboard to toggle dataLabels on or off?

How may I force a redraw of All Vaadin charts in a dashboard to toggle dataLabels on or off?
I would like to allow my app user to add/remove chart dataLabels for All charts on their dashboard; forcing a redraw similar to when changing themes say from VaadinTheme to GridTheme.
How may I achieve this?
How does changing themes work under the hood, what is the source code that does this?
e.g.;
I know I could redraw a single chart individually by resetting its plot options and then redrawing it:
.
.
.
PlotOptionsColumnRange columnRange = new PlotOptionsColumnRange();
columnRange.setDataLabels(new Labels(true));
columnRange.setDataLabels.setFormatter(/* some javascript about this.y */);
conf.setPlotOptions(columnRange);
chart.drawChart(conf);
But I want to do it for All charts on a dashboard; like having a Listener that does
ChartOptions.get().setTheme(new VaadinTheme())
then
ChartOptions.get().setTheme(new GridTheme())
and viceversa
Maybe I can reset the plotOption dataLabels then reset the theme to force a redraw with the new dataLabel state?
Please advise...
p.s.
I don't want to make changes to my user saved data in my database, i.e., I don't want this label toggle to be persistent. I want to toggle dataLabels just like a toggling themes.
Please look at:
http://demo.vaadin.com/charts/#ColumnRange
to see what I mean.
Ok, two solutions:
A coworker of mine that worked on the Dashboards helped me with the first answer to this question.
Basically, you have to clear all charts, then iterate through ea. chart in a particular dashboard (stored in the DB), and rebuild ea. chart w/ your decision to have or not have a dataLabel, placing it back in that dashboard; but I wanted to avoid this as it might take a performance hit.
Also I later got a response from Pekka of the Vadding team, as follows:
'You can easily hide the dataLabels with basic css. For example, if you can apply a stylename "dataLabelsHidden" to you UI, then you could write in your stylesheet a specific enough rule for hiding the labels. I quickly tested the demo with this:
.v-ui.dataLabelsHidden g.highcharts-data-labels {
display: none;
}
This way you won't have to update all your charts when the labels on/off is triggered.'

Fusion charts dynamic clickable

I have a scenario where in I am using fusion chart which has a multiple line chart in one fusion chart. I want to create a clickable line chart where in clicking on label that particular attribute will be displayed in graph. So basically each line chart in graph is dynamically displayed with click of button for each line chart. I hope you get my requirement. Any help will be really appreciated.
I hope I have understood your requirement correctly.
As far as I know, FusionCharts v3.2 has something similar to what you require.
From the documentation,
Interactive legends in charts that allow for selective showing/hiding of data series (or slicing, in case of pie charts)
You can see a demo of this at FusionCharts gallery