Remove duplicate values on x axis for chart js - reactjs

I have got an X axis and it has the months displaying. However for the month of august it is displaying twice...I am not to sure why that is. I would like to remove the duplicated Aug-2020 on the x Axis.
Here is a coding sandbox I created to show what I mean.

I don't know what you're trying to achieve but in your app.js file change maxTicksLimit: 5, to maxTicksLimit: 2, and it will change to single value for Aug.
You have to calculate the chart before plotting.

Related

zingchart heatmap not show all hours on y axes

I have 24 hours format values on y axis.I want to display all 24 hours on y-axis.But in heatmap using zingchart display hour in gap of 3 as shown in image.
So,what is the setting required to display all hours on y axes.
You can try setting the following attributes to adjust the max amount of items visible:
scaleX: {
maxItems : 24,
itemsOverlap : true
}
There is full information in our help center about showing hidden labels on the x-axis -> https://help.zingsoft.com/en/articles/3546391-zingchart-how-to-show-all-labels-on-my-axis

ShieldUI Stacked Bar Graph with Totals

I've got a stacked bar graph that shows two categories of information. Now I have a requirement to show the total of the bars at the end of the bar. I've attached a mock-up showing what I'm trying to do -- the numbers in red are what I'm trying to add.
(source: michaelandlisa.us)
I couldn't find anything in the documentation on how to add totals, or on how to add annotations (which would also work).
Basically, ShieldUI jQuery chart plugin renders the series without text, as shown here.
To alter this behavior, you need to first enable the text.
Then, you can use a format function to either show some cumulative text, or return an empty string. More information on this approach is available here.
This can be coupled with a global counter to determine each Xth iteration.
I managed to get this to work by adding a Scatter chart of total values on top of the existing bar chart.
http://michaelandlisa.us/Images/Forums/stacked_with_totals_scatter.png
I also set the color on the series to "transparent" so the point wouldn't show up, and then I bumped the X and Y by 15 and 12 respectively. I also set the style to Bold, and set the format to "{point.y:n0}". Here's the relevant MVC code (where totals is a List of object):
.DataSeries(series => series.Scatter()
.Data(totals)
.CollectionAlias("Total")
.Color("transparent")
.AddToLegend(false).DataPointText(dtp =>
{
dtp.Enabled(true);
dtp.Format("{point.y:n0}");
dtp.Style(s => s.FontWeight(FontWeight.Bold));
dtp.Color("red");
dtp.X(15);
dtp.Y(12);
}))

Create GitHub punch card like plots with JFreeChart

I am looking for suggestions as how to create plots similar to GitHub punch cards with JFreeChart. E.g.
I guess it's some variant of a heat map, or two dimensional histogram.
Ok, so I found XYBubbleRenderer which looks like a good starting point.
create a MatrixSeries with rows = 7, columns = 24
fill in the frequencies accordingly. I found it useful to normalise the values first to 0...1, then take the square root (smaller values have a bit better visible circles), then multiply by 0.5 (otherwise the circles are too large)
create a MatrixSeriesCollection from that
use ChartFactory.createBubbleChart
the circle outline can only be removed via plot.getRenderer.setSeriesOutlinePaint(0, new Color(0, 0, 0, 0))
ensure integer tick units on both axis
x-axis range -0.5 to 23.5, y-axis range -0.5 to 6.5 (or 0.5 to 7.5 if you use Calendar.DAY_OF_WEEK)
custom NumberTickUnit for the y-axis to use day labels instead of numbers
The result:
In addition to XYBubbleRenderer, suggested here, also consider a suitable implementation of TableCellRenderer and Icon, illustrated here.

Changing one single marker in a series in ExtJS charts

this is what I'm trying to do...
I have a chart with a line series with markers in it. In the X axis I have dates and in the Y axis a number. So lets say I have in x dates from yesterday to next week. And each day has a corresponding Y axis value.
What I want to do is change the color of the marker that belongs to the actual date.
In other words, to make it clearer, I want to change the color of a single marker in a ExtJS line series. I know of markerConfig but that doesn't seem to help since it applies to all markers.
I haven't found anything like this around so I stopped here to see if you guys could help me.
Thanks in advance!
I think the easiest way to do this is to highlight a single datapoint in a series.
First, define your highlight style.
Ext.create('Ext.chart.Chart', {
...
series: [{
type: 'line',
highlight: {
size: 10,
radius: 10,
fill: 'red'
},
...
});
Then, select the appropriate datapoint in your series and call the highlightItem() method. Here's an example showing how to use the method.
var series = myChart.series.get(0);
series.highlightItem(series.items[2]); // highlight the 3rd data point in the series
The result would look something like this.

Can I pass the Array values (not the array collection values) to the Bar charts or column charts using Flex 3.5?

Is there anyway where I can pass the Array values (not the array collection values) to the Bar charts or column charts using Flex 3.5?
Here what I need: I have array values like this,
array1 = [23, 49, 40, 239, 20, 80, 39,49,120, 24, 31,41];
and I want to show these values on the Y-axis and months on X-axis.
I have two questions:
How can I pass this array to Bar chart or column chart?
How do I need to show months on X-axis? I have kept a filters that even if we want to see some months or a particular months or particular span of months. On X-axis it need to change the months dynamically depending on the filters. For example on X-axis the values should be [Jan, Apr, Jun, Oct] if I select the 3 months period filter
I have written a logic to collect the values of those particular months into an array, but I don't understand how to pass this array to Bar chart, because there I don't know what X-field and Y-field to be given.
1) how can I pass this array to Bar
chart or column chart.
The dataProvider property of the charts is an object. So you can send anything you want in there. I would expect it to handle an array just as well as it would handle an ArrayCollection.
That said, I believe you're going to have to send in objects with data properties that represent the xField and yField values. An array of simple values doesn't give the component enough information to know what to do.
2) how do I need to show months on
Xaxis. beacuse I'm asking this
regarding, I have kept a filters that
even if we want to see some months or
a particular months or perticalar span
of months... there on Xaxis it need to
change the months dynamically
depending on the filters..... (for ex,
on Xaxis the values should be (Jan,
Apr, Jun,Oct) if i select the 3 months
period filter....)
I believe if you create objects, as I stated before with the Xfield value being a string representing the month and a y field value representing your data point, the graph should know how to display the values.
If you were using an ArrayCollection you could easily use the collection's filtering abilities to change the dataProvider, which I would expect would change the graph.
More docs on this

Resources