How to scroll QChart - qt

I am creating a plotting application with QCharts.
I have realtime data, so I need to periodically update the chart.
I use QCharts::scroll function, but it does not seem to be working.
For example scroll(100.0, 0) shifts only 0.84 on the x-axis.
What am I doing wrong ?
Here is documentation for the method: https://doc.qt.io/qt-5/qchart.html#scroll
Thank you very much

Related

How to check if a plot is visible under a tab panel?

I am working on data visualization with R and shiny.
It takes some time to load my visualization and be able to provide plots under tab panels.
Ex. I made 3 tabs for box plot, bar plot, and bean plot
Taking time to visualize the result is understandable, but I am not sure how to check if the plot is visible so that users do not need to wait even though incProcess function reports the program is done.
First, I recorded the time to visualize and tried to delay some time, but it is very subjective to the data input, so I do not think that is a good solution.
Would you be able to provide me solution?
Thank you
I think I need a solution NOT to check if a code is done but the visualization is done.

Removing grid lines in a map and smoothing in maps

I am trying to remove the grids on my map. I used several commands for example: plt.grid(), plt.rcParams["axes.grid"] = False but nothing happens, the map produced as is with the grids. Is there any possible way to remove the grids?
Another thing also, how can I make my plot to be smoothed instead of having the data as blocks (see below a sample of the plot).
enter image description here
Please assist in this regard.
Truly appreciate your time.
Thank you.

Manually Drawing Curves on R like Paint

I was trying to allow the user to give a curve as input for some analysis. Is there a package that can be used in this regard? Basically, a GUI like paint wherein the user can draw a simple curve and which would be stored in R as a set of data points or as an equation if its a simple curve.
Thanks
Gopher
Reading mouse input
Below is a list of sample approaches to first the problem, from the most complex to simplest (IMHO).
I would recommend that you have a look at the
qtpaint
package.
Less laborious solution may involve looking at the way interactive
plots in Shiny are handled. Using the click option would
enable you to get the mouse cursor position. Together with the Shiny
framework this would provide a convenient wrapper to get mouse input
from a user.
Finally, third approach could rely on making use of the locator function available in the graphics package. Depending on what you intend to do, this may be the simplest solution as you could then use read values to inform generation of your graphic.
Generating graphics
Assuming that you got your values via the locator functionality you could attempt to draw your line using segments. It would be a little fiddly as you would have to translate your coordinates to some placement of the dot in your desired chart but this wouldn't computationally too taxing, just a matter of bring mouse pointer values to some x/y values on the chart.
If you care to update your post with a sample code and reproducible attempts of your previous work, I bet the question will receive more replies. You may find this discussion on making a reproducible example in R helpful.

Qwt: How to delete all items(curves, markers, etc...) from plot

I want to delete all items from my plot. I found this:
plot->detachItems( QwtPlotItem::Rtti_PlotCurve ,true);
plot->detachItems( QwtPlotItem::Rtti_PlotMarker,true);
But, it does not delete clearly. Somethings remains background. I tried on a example. And memory leaks occurs. How can clear all plot?
Thanks for advices.
You should call QwtPlot::replot() after modifying your plot. Add this line after your code:
plot->replot();
Or you can enable auto replot during initialization, QwtPlot::setAutoReplot(true), that way you don't have to call replot every time you change something. On the other hand, if you frequently update your plot, I would advise agains auto replot due to performance reasons. It's better to call replot() explicitly in such case.

How do I get the current filter for a crossfilter dimension?

I have a crossfilter.dimension. How do I get the current filter set on it (for example if it was set by a brush from a chart)?
Example:
dimension.filterRange([1,15]) // returns dimension
Given this filtered dimension, how do I get the values 1 and 15 out?
Stumbled on this old question because it is the top-voted unanswered crossfilter question, with 1k views!
This feature was contributed by Thomas Gillet in 1.4.5 as dimension.currentFilter()
The tough remaining problem: when you get beyond filterExact and filterRange, the more complex filters use filterFunction. You might be able to retrieve the function but functions are essentially opaque.
For example, if you are using dc.js, it will generate a filter function when
multiple items are selected in pie chart, row chart, or bar chart with ordinal dimension
the chart has a two-dimensional filter, like the scatter plot or the heatmap
For this reason, if you're using dc.js, you should use chart.filters() instead.
Thank you, Gordon. This was really helpful to me! One note - your link is correct -- it goes to filters(), but the text displays as chart.filter() which is in the API, but doesn't return multiple filters on a chart. I tried to edit your answer, but it won't allow single character changes!

Resources