FLEX: Make LineChart DATATIP constrain to vertical axis - apache-flex

When making a line chart, Lets say its for business sales for different depts and horizontally is days and vertically is dollars. When you hover over a line it tells a dataTip tells you the sales for that dept. on that day. I want it to show all the depts at the same time, so say you hover over day 3, I want the dataTips for all depts on day 3 to display so you can compare the values for all the sales on the same day. I set the mouseSensitivity for the dataTips to display all the lines at once but I end up getting day 2 for one dept and day 3 for another which is not wanted. This is actually posted as a bug and explained better here: http://bugs.adobe.com/jira/browse/FLEXDMV-1853
I am wondering if anyone can come up with a work-around for this?
Thanks!

I ran into a similar problem to this recently and came up with a solution that also applies to your problem. I had a step LineChart and wanted to display a data tip when the user hovered anywhere on the line instead of just at defined data points.
You can read about the solution I wrote for that problem here: Flex: Customizing data tip location and behavior in a LineChart
You'll have to modify my solution slightly to fit your problem:
On line 47 you can remove the Math.abs(last.y - mouseLoc.y) < 50 check. This constrains the data tips to lines that are within 50 pixels vertically of the mouse.
I'm assuming that you're using the default segment line chart which just draws lines directly between data points. You'll need to modify the code that calculates the line value at a given x-coordinate to work with that chart type. I already find the closest data point to the left of the mouse with lines 33-41 and store it in last. Just get the next data point (which will be the one closest to the right of the mouse) and use something like this to get the value at the mouse:
var slope:Number = (nextPoint.y - last.y) / (nextPoint.x - last.x);
var lineYAtMouse:Number = (slope * (last.x - mouseLoc.x)) + last.y;
var lineValue:Array = line.localToData(new Point(mouseLoc.x, lineYAtMouse));
Then replace lines 69 through 72 with:
hitPoint.x = mouseLoc.x;
hitPoint.y = lineYAtMouse;
hitPoint.xValue = lineValue[0];
hitPoint.yValue = lineValue[1];
I haven't tested these modifications so there could be a bug or 2 but the general idea is there. I hope maybe this is still useful to someone. This question is getting pretty old. :)

Not an answer, but a poor alternative:
You could create your own DataTip renderer that [ahem] mapped the location of every point and drew the tip for each one there.
Basically, you would be duplicating a lot of the code inside the charting classes.

I have the same problem but working on column charts. Was thinking that I could enable the vertical gridLines using backgroundElements and then add a chart event listener for mouse over (which fires when mouse passes over a vertical gridline). Using the localX value, i could compare it to the closest datapoint, maybe.
Brian

Related

resourceDayGrid with vertical days headers

I'm using resourceDayGrid for recreation functionality of grid previously used:
previous grid.
In resourceDayGrid - day headers are displayed under resources (as columns):
current resourceDayGrid
Is there any property/configuration changing day header display position to vertical (rows)?
No there isn't.
The closest you could get to your original grid is the timeline view which splits the dates/times and the resources onto separate axes, but it's always arranged so that resources are on the Y axis and times/dates on the X axis - i.e. the reverse of your previous arrangement. But the effect is similar.
There is a demo here showing the day/week/month versions of the timeline so you can get a idea how it looks. There are some things you can configure, but flipping the axes isn't one of them unfortunately.
You could check if anyone has requested this feature in fullCalendar, and vote for it, or request it yourself - see here for details.

Split x axis for every value in graph, in Power BI

I have the following graph in Power BI:
and I'm trying to recreate the below graph from Excel (note the X axis with the months February and January, with the Operation Text:
As you can see, my attempt only displays the Operation Text rather than the month and Operation Text).
Here is what my current axis looks like:
Changing the axis to have Actual Start Date on top, rather than the Operation Text:
Makes my graph look like this:
Is it possible to achieve the same outcome as in Excel, with the values in my graph showing the two months side by side, for each operation text? If so, how can I do this?
I've tried looking into the X axis 'format' settings and wasn't able to see anything obvious to help achieve this. In addition, unfortunately the graph I'm looking to recreate is only a screenshot so I am unable to see how it achieves that outcome.
EDIT:
As suggested, I attempted to place Operation Text into the Legend field in my Visualisations section but I am unable to, due to the fact that I have two Value fields (the two columns Actual Hours and Estimated Hours).
#CR7SMS is correct. You just need to expand down to the next level using that split arrow in the upper right of the visual so that this:
Becomes this:
Note that to get the axis to look like this, you'll need to sort on month rather than one of the measures.
You'll also want to turn off 'Concatenate labels' toggle in the 'Format > X axis' section of the visual settings.
You would have to drill down one level, using the arrows seen at the top right of your first screenshot. For your specific purposes, the split arrow should do the trick. Hope this helps.
Have you tried moving your date or operation text column in legend section ?..not 100% but something close to your requirement you can achieve

Hide/show multiple graphs in qcustomplot

I am making a data logger for a couple of Arduino sensors in Qt. The problem is that I want to log the data in 3 different graphs, each of one having one specific scale, and then I'll choose what graph I will show (just one of the 3 graphs will be displayed at one time).
I tried something like this:
QCPGraph *sensorXGraph = ui->graph->addGraph();
QCPGraph *sensorYGraph = ui->graph->addGraph();
sensorXGraph->setVisible(false);
sensorYGraph->setVisible(false);
And then, in a slot call from a RadioButton clicked event I did:
sensorXGraph->setVisible(true);
sensorYGraph->setVisible(false);
And the inverse for another RadioButton. But the graph seems to keep the axis of the last graph created. So, if I try to see the sensorXGraph, the data will change accordingly but y axis range will be the one of the sensorYGraph.
I also tried to make a single QCPAxis for each graph, but it started to be a mess because I had to make QCPAxisRect for each graph as well and the result was worse than the first trial.
How do I achieve to change from one graph to another properly?
Thank you in advance.
You can call clearGraphs() on your QCustomPlot and then add whatever graphs you want to display by calling addGraph() and then call replot() on your QCustomPlot. So it would be something like this:
ui->graph->clearGraphs();
ui->graph->addGraph();
// Do whatever you need to do to edit your graph.
ui->graph->replot();
Since you are using a radio button I think that it would be easier to draw one graph and add the necessary data and labels based on whatever radio button has been selected. Hopefully that helps!

Creating a grid on a map in R using grid points

I'm clearly struggling with this problem for a day now and can't seem to find a nice solution to it. I would really appreciate some help and I'm really a novice in R (since last week).
Problem 1:
I have a set CSV representing grid points which I can parse into a data frame (pointname, latitude, longitude).
Eg:
name,latitude,longitude
x0y0,35.9767,-122.605
x1y0,35.9767,-122.594
x2y0,35.9767,-122.583
x0y1,35.9857,-122.605
x1y1,35.9857,-122.594
x2y1,35.9857,-122.583
x0y2,35.9947,-122.605
x1y2,35.9947,-122.594
x2y2,35.9947,-122.583
The points in this file represent the lower left corner and are arranged in row major format, meaning lowest horizontal grid points first. Each point is a certain great circle distance away from its neighbors (1km). I want to create a grid overlay on a map which I've plotted using ggmap.
What I've tried or considered:
map.grid() - this is really not useful to me as I'm not looking for any kind of projection.
geom_vline() and geom_hline(). These look good but I don't have constant x and y intercepts on a plane. Moreover, once I create a grid, I'd like to use the grid to color against a density.
geom_rect() and geom_tile(). These look really promising and may be what I want. But I'm not able to find a good way of working with these.
I'd like to fill these grid boxes later with another parameter. Any suggestions on how I can create such a grid? This may be a trivial question but I don't know a lot of R yet.
Problem 2:
How can I store or hold such a grid so that I given a point (lat,lon), I can quickly get to that grid. In fact my whole back end is in C++ and can directly output the grid name x<n>y<n> directly against a given search point. I somehow am finding it difficult to count such points against grid points so that I can fill grid with a representative color.
I'm not sure if everything of what I'm saying is clear. Please tell me if I've to clarify something.
Also note that I've Googled quite a lot and not found relevant answers although some looked close.
Eg: This, ThisToo
Thanks for the help!

JAVAFX 8 Chart: get style of existing plotted series

This is a follow up to this question which has to that day still 0 answers.
What I really want to do is having in a tableview, a column that has the symbol for the plotted data corresponding to the objects in the table view row. I have managed to generate the colours supposedly followed by the JavaFX chart. The issue I have of course is that my own colour generation works (it goes back to the first colour without fail after 8 elements), when the one from the chart has the issue outlined in my unanswered question.
So.
I would like now to try to pick up the style actually applied to each series of the chart independently from pre-supposed rule about the default order of colours. How do I do that?
This way I could apply those to my table view and even if the colours randomly change upon reloading then at least I will know what I am looking at.
Thanks in advance for your help.
After a bit of research I found that the following code allows me to get what I want, supposing I am interested in the series at index intitem:
plotswingschart.getData().get(intitem).getNode().getStyleClass();
This will produce a ObservableList containing the following string values (here example for the series at index 8 (9th series)):
chart-series-line
series8
default-color2
From this I can then get the information that I need. that is the colour actually applied to that curve. I can then generate a symbol to be used in my tableview.
I would still be interested in an answer to the question linked, which prompted the present question...

Resources