How to check the type of chart using jfreechart - charts

I'm using Jfreechart to build & display charts.
I'm wondering, that it seems, there is no standard way, to check the type of created chart (e.g. bar, scatter etc).
currently im checking the underlying plot to get the chart type, but i believe this option is limited, when comparing scatter chart with line chart.
Is there any better way, to differ the chart types after it has been created?
Edit:
Basically i want to apply data on charts. I'm using different charts (lets say ScatterChart and XYLineChart). I have one method, which shall apply the data based on the chart type. Both charts have the same plot type, so i cant distinguish them. The distinction is needed, as i need to change the shapes and line styles for the scatter chart.
I already solved this, by using different methods to apply the data. But thats actually a dirty workaround. I came across on several issues, where distinguishing chart types would be very useful in my case.
Thats why im asking, if there is a standard way, to obtain the chart type of an JFreeChart object

Is there any better way to differentiate the chart type after it has been created?
The API provides no such distinction. The combinations of dataset (model) and renderer (view) constructed by the static factory methods in ChartFactory are common, but by no means exhaustive. The names are descriptive only.
I'm using different charts, lets say ScatterChart and XYLineChart…Both charts have the same plot type, so I can't distinguish them.
In particular, both factories construct a chart with an XYDataset in an XYPlot, combined with an XYLineAndShapeRenderer. If casting is undesireable, eschew the factory method and construct the chart manually, as shown here.
More generally, consider using the strategy pattern, cited here and illustrated here, to select the desired behavior at runtime. An enum of your chosen chart types would work well in this context.

Related

Looking for the name of a chart

I am not sure if this is the right place to ask, but I didn't know where else to ask. I have two dimensions: Shoe company (Nike, Adidas,s etc) and Shoe type (Trainers, pumps etc). I have one metric Shoes sold.
I want to create a chart similar looking to a Sunburst chart however the two dimensions are not hierarchical. I couldn't find what I was looking for so drew a picture, please excuse my lack of artistic talent. Does anyone know what a chart like this would be called, or where I could go about making one (preferably excel but any language would do (I can learn it if needed))
Unfortunately, that's not a chart type that Excel can create as an all-in-one chart. That said, you can still make that chart with a few simple workarounds.
The approach is basically to create two pie charts and put one over the other. To make the one you posted, you'd just have to create a standard pie chart for shoe company info. Then create another (smaller) pie chart for shoe type. Drag the shoe type chart over the shoe company chart.
(You can also use a doughnut chart for the same effect: https://best-excel-tutorial.com/56-charts/209-multi-level-pie-chart)

Plot the ECG labels and the ECG using Flutter web

I am trying to plot both the labels and the ECG using Web Flutter. ECG plotting is happening properly but not the annotations. Can someone suggest me something for this? It should look something like this.
Found a library call syncfusion. It shows how to add multiple annotations. But the annotation that I am using is a list.
We have created a simple sample by using annotations in the chart. We have provided two annotations in the annotation list such as high and low texts for the high and low values in the chart. The two annotations are provided in the annotation property available in the chart which takes a list of type CartesianChartAnnotation.
The sample for reference can be found below.
Sample
And, we have analyzed the mentioned query ECG plotting is happening properly but not the annotations, but we are not sure of what exactly you are conveying. So, we request you to provide more detailed information for this query so that it will be helpful in providing the solution sooner.

Is there an option to remove duplicate point labels within a distance in Mapbox Studio?

I'm using Mapbox Studio to label some point features (from a GeoJSON layer I uploaded) in a style, and there are some duplicate points located nearby each other:
Are there any options in Mapbox Studio to remove the duplicate labels automatically? For example, some other mapping programs have the option to remove duplicate labels within a specified distance (pixels or map units). Is this available in Mapbox Studio (or failing that, in Mapbox-GL-JS)?
Mapbox Studio does not provide a way to remove the duplicate labels automatically. You could work with a filter to manually filter out duplicates by writing a relatively complex expression, although this is not really the intended use case of expressions. You could also add a duplicate: true property to duplicated point features in your source data, but since this would require manipulating your source data, you might as well remove the duplicates from the source data instead of taking this approach.
That being said, you could consider clustering your data and styling the clusters so that a cluster looks the same as any individual point. This example shows how to create and style clusters using Mapbox GL JS. Here is a JSFiddle that heavily modifies this example to cluster closely-located points, and style the clusters in the same way that individual points are styled: https://jsfiddle.net/uo216fxz/ (you will need to add your own Mapbox access token in order to view the result). Text labels are added with the point count for each cluster containing more than one point, so that you can easily see that clusters and single points are identical aside from the labeling.
You will likely need to customize several properties (such as clusterRadius, clusterMaxZoom, etc) beyond what is provided in the linked JSFiddle, to be more specific to your source data.

Google Charts trendline y-intercept

I've been trying to force a trendline through 0,0 for my scatter graph, but I can't seem to find a way to do this.
From the docs here, they don't give any information on it: https://developers.google.com/chart/interactive/docs/gallery/trendlines
But, I know there are lots of undocumented stuff in charts.
This is an example of what i am trying to do within Google charts(Done within excel)
The red dotted liner is the trendline, on the left is the default liniear regression that Google charts can give, but in many situations you would want to force a Y-intercept, in this example its forced to be at 0
No, you should NOT need values to force an intercept. This is a pretty standard option in graphing programs. Unfortunately, I don't see where Google Sheets gives you the option, which is one reason I don't recommend it for serious data analysis.
It's odd that the LINEST function allows you to force a zero Y-Intercept, but the trend-line tool in the Chart Editor does not. Excel offers a checkbox to force the line through the origin. (Of course, one should exercise caution when doing so. You really have to know something about the data your analyzing.)

How to update data changes in an already drawn SPSS graph

I have drawn several bar chart, scatter, and line graphs in SPSS 21 and spent lots of time on editing their look. But, I realized that I made some mistakes in data and they are already changed. In Microsoft excel, graphs are interactive/dynamic, meaning that they change if you modify the values of each cell. Can we mimic the same feature in SPSS 21? Is there any way I can update graphs without redrawing them from the scratch? I have saved them as output, but when I load them no change is reflected and the graphs are associated with old data.
I have saved syntaxes to produce the graphs, but when I run the syntax, the graphs are produced in standard looking that need lots of changes to look good. When I save chart templates and apply them to new charts, they don't look the same meaning that some of the changes are not applied.
Please help.
It is not possible. I feel you with making all the changes and the inconsistency in applying chart templates though. A few tips to mitigate this in the future are;
Do everything you can with GGRAPH and inline GPL statements to get the look of the chart close to how you want it.
Start with a chart template that is closer to your typical end goals. (See here on how to make some simple edits to the default template).
Some things are still difficult to fully automate like label placement in the chart. These simple tips though get me very close to the end goal, and only rarely do I need to take the time to polish a chart with editing post-hoc.