I have a chart with several series on it, one of which is a flag series. The data on the flag series is reasonably sparse, but very bursty. As a result when I am showing a large amount of data, ~10 flags tend to line up up next to each other all pointing to basically the same point on the graph.
What I'd like is for those flags to get downsampled (in a sense) so I only show 1 flag indicator that points to the general area where all the flag points are, then when the user zooms in, all the flag points are displayed since it's now possible to actually distinguish what they are pointing at.
This seems like a job for data grouping and when I am zoomed out and showing large data ranges, all my other series end up getting downsampled by data grouping. However, this isn't being applied to the flag series, I suspect because the series doesn't qualify since it has relatively few points across the range being shown.
Does anyone know if there's anything built in that will help me achieve this? Or do I have to write my own downsampling that's tied into the setExtremes event somehow?
Thanks.
On the same (lat,long) on a Tableau-Desktop map, I want the size of a dot to be proportional to the number of records at that location. I tried count/sum(Number of Records) built-in tableau measure, I created a SeqId and tried count(SeqId) for Size, neither worked. Here is a sample of my data, as you can see:
(44.92810490,-74.89186500) has one Record
(44.69948730,-73.45291240) has five Records
(44.72143010,-73.72375280) has 10 records
I would like the point to be proportional to the number of records at that location. Help is Much appreciated
Musa
Seq Id,Census,Gender,Lat,Long
1,1860,F,44.92810490,-74.89186500
2,1870,M,44.69948730,-73.45291240
3,1870,F,44.69948730,-73.45291240
4,1870,M,44.69948730,-73.45291240
5,1870,F,44.69948730,-73.45291240
6,1870,F,44.69948730,-73.45291240
7,1870,M,44.72143010,-73.72375280
8,1870,M,44.72143010,-73.72375280
9,1870,M,44.72143010,-73.72375280
10,1870,M,44.72143010,-73.72375280
11,1870,M,44.72143010,-73.72375280
12,1870,M,44.72143010,-73.72375280
13,1870,M,44.72143010,-73.72375280
14,1870,M,44.72143010,-73.72375280
15,1870,M,44.72143010,-73.72375280
16,1870,M,44.72143010,-73.72375280
Can you try this?
Create a calculated field "Geo" with this definition
IFNULL(STR([Lat]),"")+ ","+IFNULL(STR([Long],"")
Move this field in "size" mark using Count([Geo])
Hope this should give you the desired result.
Put Latitude on the Rows shelf, and then right click on the pill and convert it to a dimension. Make sure it stays continuous.
Likewise, put Longitude on the Columns shelf and convert it to a dimension
Put SUM(Number of Records) on the size shelf
Important, Don't have any other dimensions on any shelves, leave SeqId off
This approach will make one mark for each unique latitude/longitude pair and size that mark according to how many times that pair appears in the data set.
A problem you will probably notice is that two latitudes that differ only in the final decimal place are treated as distinct latitudes. That may not make the most useful visualization. You can bin nearby latitudes together by making a calculated field to round values to the degree you wish. If you do that, be sure to make your field a continuous dimension, and also set its geographic role. It has the effect of snapping lat/long pairs to a grid. As an alternative to rounding, you can look into the hexbinx() and hexbiny() functions.
For a heat map based on square or hex grids, you may want to try using (partially transparent) colors instead of size to indicate density.
I need to draw multiple plots. How can I set the position of each plot in codes instead of setting one by one in storyboard?
The image I want to achieve is here. In this image, each small curve is a plot. So there are in total 20 x 15 small plots. I need to position and feed different data for each of them. But I don't want to set their positions one by one coz it's tedious.
Do you need to allow user interaction or frequently update the plots? If not, your best bet is to use one graph with a single plot. Render it into small images, once for each plot, changing the data each time. Draw the images into a view laid out in your grid.
If you can't use the image approach, you'll probably run out of memory long before setting up 300 individual graphs. Instead, use one graph with a single plot space if possible. Offset and scale the data values for each plot so they appear in the appropriate section. Use as few plots as you can (one for each line style). Separate the line segments with empty (NAN or nil) data values.
I just happened to stumble across "CPScatterPlotInterpolationLinear" via google search for 'interpolation'.
Does this mean that I could plug gaps of scatter/linear data via interpolation?
I had asked a similar question earlier and was told that CP doesn't add points to a graph.
I attempted to create a 6-month fixed-interval scatter plot by creating an array of 180 elements for 180 days/6 months. The missing data/day were filled with [NSNull null] objects... but CP merely plots the non-nulls without the interpolation.
The 'CPScatterPlotInterpolationLinear' enum got me to re-think.
Question: How do I employ 'CPScatterPlotInterpolationLinear' to interpolate missing data on a graph? ... no need to actually add data points, just 'connect the dots'.
When you set the line style on a scatter plot, Core Plot will connect the data points with a line drawn using the given style. The interpolation property controls how the points are connected:
CPTScatterPlotInterpolationLinear: This is the default. Data points are connected with straight lines drawn directly between successive points.
CPTScatterPlotInterpolationStepped: Steps are drawn beginning at each data point.
CPTScatterPlotInterpolationHistogram: Steps are drawn centered at each data point.
CPTScatterPlotInterpolationCurved: Data points are connected with a smooth curved line drawn between successive points.
None of these styles will add data points (i.e., points that can be indicated with plot symbols or data labels). They simply connect the data points provided by the datasource.
I want to use core-plot for drawing line graph dynamically. data won't come at a time, we will be receiving point by point dynamically.
Is it possible to draw the chart dynamically using core-plot i.e drawing point by point as on when we receive the (x,y) point?
Please help me, Thanks.
Yes, you can do this reasonably easily. For each received data point, append it to an array of values to display. As these data points come in, call -reloadData on the Core Plot graph (or just the particular plot) to redraw the graph, passing in the array you just added a value to in response to the -numbersForPlot:field:recordIndexRange: delegate method.
If you need to adjust the plot range to track your data points (for a moving ticker), recalculate the new CPPlotRange for the X axis and set the plot space's xRange property to that.
Use the CPTestApp-iPhone, AAPLot, or StockPlot examples as templates for how to set up the line chart overall, and modify from that starting point.
I do something similar to this on the Mac in a scientific application:
(source: sunsetlakesoftware.com)
Sounds like you could make use of a demo project I put together and wrote about here (not core plot related though).
It draws a EKG graph but should easily be modified to use another input than the repeated "heart beat"...See line 320 in EAGLView.m where the indata is entered into the array.