Q: Recharts hide every other label? - recharts

Hiyas, I'm wondering if it's possible to render every other xAxis label in recharts?
I have a design I'm working from that has vertical grid lines on either side of an xAxis label. So, I'm using <ReferenceLines> in place of a <CartesianGrid>, and that seems to work well. However, I haven't found a way to render only some of the xAxis labels.
I could mutate the date coming into the chart, but then I lose the data-points date value in the <Tooltip> hover. Which if possible I'd like to keep.
Here's effectively what I have:
And here's what I'm aiming for:

Ok, so I found a "way" by leveraging the tickFormatter attribute on <XAxis />. Albeit, the best approach would be for tickFormatter to return index like some of the other recharts components offer with format. However, for the time being I'm simply finding the index of a given xAxis label, from my dataset, and then checking if it's an even/odd number.

What you're looking for is the interval attribute. This controls whether to show all or some of your xAxis labels. By default it is set to preserveEnd which auto calculates how many ticks to show.
If you want to show all ticks, you must set interval=0
Docs https://recharts.org/en-US/api/XAxis#interval

Related

Amcharts legend dynamic resizing

I want my legend to adjust itslef according to the amount of data that is coming in like highcharts . For example if I have only one legend I don't wanna legend to take the length as the div itself and I also have multiple pods .if there are a lot of legends I want it to have scrollbar instead now it's reducing the size of the chart itself.
Pls give your valuable inputs .
You can have the Legend rendered inside a defined Element referring to it using divId.
Then just make sure your legend element is setup to use scrollbars.
Please check the example here: https://codepen.io/team/amcharts/pen/dac1c66de18a50661c8195d4b792a30c

Birt: Formatting chart tooltip and adding aggregation to a chart tooltip?

I have three questions regarding Birt Tooltip
1) How do I format the number in the default tooltip (If I am not adding anything to the tooltip text). I tried to change the format of tooltip of Y Value Series but I realized that only works if I have put an expression in the tooltip of the Y Value series. I have not edited the tooltip of Y Value series, the chart will show the default data label instead and I am not sure how to format the default tooltip
2) I have plotted sum(revenue) on Y axis and months on x axis. I wanted a custom tooltip so I edited the tooltip expression of the Y Value series in chart. What I found was that the default tooltip was showing correct value but If I put the same expression row["revenue"] in the tooltip, the tooltip shows a data value that is much less than sum(revenue) that is plotted in the bar. I believe that this is because the tootltip is not aggregating the revenue? If Yes, then how do I put the sum(revenue) in the expression?
3) I wanted to add another information (count of units sold) so I created an aggregation count(unitssold). I called this cnt_unit_sold and added this to the tooltip of chart. The problem is that if I put my mouse over a month bar, the tooltip shows aggregated count for all months rather than that specific month. How can I add grouping to the aggregation so that it shows the aggregated count for each month rather than for all months
Regards
Arif
OK, so in case if someone has not found an answer to this question, here is the answer. In order to add aggregation to the tooltip, you need to create aggregate outside the chart's contains (for example create aggregation inside a grid). Then you can use that aggregation in the tooltip
Arif
I someone is still trying to achieve this, now you can use "valueData" instead.
row["dim1"]+" for "+row["period"]+" : "+valueData
in my example (the code goes in the tooltip expression) I asm using a stacked barchart, dim1 is the series used to stack values and period is the X series. Valuedata is the Y value (aggregated)

JQplot- Editing built in Axis Values

I tried Implementing Line Graph using JQPLOT. i want to disable the X-AXIS values which are dynamically built up in the code. I was able to hide the Y-Axis in Jqplot.min.css and I want to do the same for the X-axis .. Can someone please suggest something?
Any other logic to give our own X-axis values is much appreciated.
Thanks
here the link where you can get your answer:
Jqplot Docs
Look at the options for axes, ticks[] can contain your own x-axis values.
different show options can hide your x-axis or just the tixks also.

Telerik RadChart autosize x-axis labels (non-numeric)

I have DataBind(ed) a RadChart, and the x-axis values are non-numeric (text). I have already added XAxis-Appearance-LabelAppearance-RotationAngle="45" to better display the x-axis labels. I am unable to find a way to make the space that contains the x-axis labels autosize. Is this possible?
example (the rotation works, the others were my unsuccessful attempts at autosizing the label area):
<telerik:RadChart ID="RadChart1" runat="server" Width="600px">
<PlotArea XAxis-Appearance=LabelAppearance-Dimensions-AutoSize="true"
XAxis-Appearance-LabelAppearance-RotationAngle="45"
Appearance-Dimensions-AutoSize="true"
</Plot Area>
</telerik:RadChart>
Thanks!

Extending chart functionality in SSRS

The default chart object in the SQL Server (2005) Business Intelligence Development Studio doesn't seem to some have formatting options like :
specifying the text direction of labels in the x and y axis
adding a trendline to a bar chart
arbitrarily resizing items in a chart - for example, if I resize the chart object, everything gets resized accordingly but I can't keep the size of the chart the same while extending the area of the legend for instance.
multiline chart labels
So what I want to know is
is there any easy answer to the formatting problems mentioned above?
what websites/books/resources/examples would you recommend I look
into for extending the functionality of the chart object?
Some colleagues of mine gave up on the stock control and bought Dundas charts
The stock charts are cut down versions of Dundas.
yes you can specify the text direction of labels in the x and y axis
Go to chart properties and in the tab x and y axis enter the chart title and in the title align use the combination like left/right/center align.
you can change the legend line go to the chart properties click legend tab inside this
there is an option for "display legend inside plot area" and you can include the trendline there
you can use multiline text labels when the text limits extends
I don't see how you can resize the legend, puting inside the plot area looks ugly for pie-chart
I'd recommend go with the dundas chart components gbn suggested.
If that's not possible at least this article should solve issue 1.

Resources