This is a migrated thread and some comments may be shown as answers.

Hiding particular Y-Axis

7 Answers 65 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Kinnar
Top achievements
Rank 1
Kinnar asked on 31 Aug 2012, 02:43 PM
Hi,

We are using telerik Rad Chart for showing multiple Y-Axis. We are having requirement where we are showing week-to-week data.We are showing at the max 4 series for particular week depending on values we are having for that week. This has been result us to show multiple vertical bars(Y-Axis) per week. Now there may be the case where we are not having value available for some series. In that case what happening is that the vertical bars which are having corresponding series value are getting displayed and other bars are not getting displayed. Due to this, we are encountering space in between the vertical bars(Y-Axis) for that week. This is something we do not expect. All the bars should be adjacent to each other even if particular bar in between is not getting displayed due to not having any value. 

We are using additional Y-Axis control to support multiple Y-Axis.

  

7 Answers, 1 is accepted

Sort by
0
Peshito
Telerik team
answered on 05 Sep 2012, 08:27 AM
Hello,

If I understand you correctly you'd like to add and then hide the additional vertical axis corresponding to one of your series when it has no values or it is removed. If this is so you could try removing the additional axis when you are in that scenario:
radChart.DefaultView.ChartArea.AdditionalYAxes.RemoveAt(1);
and then you could add your additional axis again like this:
radChart.DefaultView.ChartArea.AdditionalYAxes.Add(new AxisY() { AxisName = "addtitionaAxisY1 });
Doing so should remove the axis and the space it has been taking, as well.

Hope this helps.

All the best,
Peshito
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Kinnar
Top achievements
Rank 1
answered on 05 Sep 2012, 09:00 AM
Hi Peshito  ,

Thanks for your reply as we are holding on this.

As per your feedback, we need to write logic for hiding/showing Y-Axis in code behind file. Is it possible to handle it in XAML ?

If we need to write logic for hiding/showing Y-Axis in code behind, then which event should we subscribe to? This event need to be raised for every week period where we are are showing multiple Y-Axis.

Kindly let us know your feedback on this.

Regards,
Kinnar
 
0
Peshito
Telerik team
answered on 06 Sep 2012, 06:43 AM
Hello Kinnar,

You can subscribe to the chart's LayoutUpdated event and depending on your logic you can change the visibility of your series and additional axes as well.
For example:
void radChart_LayoutUpdated(object sender, EventArgs e)
{
    //your logic here
    radChart.SeriesMappings[2].SeriesDefinition.Visibility = SeriesVisibility.Collapsed;
    radChart.DefaultView.ChartArea.AdditionalYAxes[2].Visibility = System.Windows.Visibility.Collapsed;
}

I have also attached a sample example demonstrating the above.

Hope this helps.

All the best,
Peshito
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Kinnar
Top achievements
Rank 1
answered on 15 Sep 2012, 01:31 PM

Hi Peshito,

Thanks for your reply on this. But we are having issue with code-snippet you have described. 

The issue is:  We are showing month-to-moth/week-to-week data. Each month/week will have multiple vertical bars bind to multiple series. Suppose we are showing data from Jan2012 to June2012. The June2012 will have multiple bars with multiple series binds to them. Series 1 is bind to 1st bar; Series 2 is bind to 2nd bar and so on. This will again repeat for Feb 2012 and so on. Now, the code-snippet given by you is not hiding series visibility for particular week/month. As per the code, the particular series is getting hidden from entire chart if its not having any value. But this is not something which we are expecting. As per our requirement, Suppose Series 1 is having data for Jan2012 then it will be visible for Jan2012, but if its not having any data for Feb2012, then it won't be displayed for Feb2012. 

I hope this will clear our requirement. Looking forward for your solution on this.

Regards,
Kinnar


0
Peshito
Telerik team
answered on 19 Sep 2012, 10:00 AM
Hello Kinnar,

Thanks for sharing your requirements with us. Could you please tell us if there is a specific issue you are experiencing when using our control or provide a snapshot of your expected result, so we could advise you with an appropriate solution.

Regards,
Peshito
the Telerik team

Time to cast your vote for Telerik! Tell DevPro Connections and Windows IT Pro why Telerik is your choice. Telerik is nominated in a total of 25 categories.

0
Kinnar
Top achievements
Rank 1
answered on 24 Sep 2012, 02:52 PM
Hello Peshito,

Please consider chart given at this link : http://www.telerik.com/help/silverlight/radchart-features-axes-multiple-y-axes.html 

The chart is showing multiple Y-Axis namely "MegaWatt[MW]" and KiloWatt[KW]". The chart is having multiple series binds to these Y-Axis. These series legend are "North[MW]" and "South[KW]" respectively. As per this chart, we are having values available for both of these series for X-Axis labels namely 1,2,3....10.  So, both the vertical bars are getting display for corresponding  X-Axis label.Suppose, we are having only one series(legend:North[NW]) value available for X-Axis label 2. At that point of time, only one vertical should get display for X-Axis label 2.

We are exactly having the same requirement described in above paragraph. But in our case, we are displaying four series. So, we are having four vertical bars gets displayed for corresponding X-label.First vertical bar represents Series 1 Value. Second vertical bar represents series 2 value.Third vertical bar represents series 3 value.Fourth vertical bar represents Series 3 value. Now consider the case where we are having values available for series 1,series 3, series 4 , but not for series 2 for one of the X-Axis label. In that case, 3 vertical bars related to series 1, series 3 and series 4 are getting displayed, but they are leaving empty/white space for series 2  vertical bar. This is something unexpected. We want that all the 3 vertical bars related to series 1,series 3 and series 4 should displayed together if value for series 2 vertical bar is not available. How to achieve the case of displaying  vertical bars together/side by side to each other even if the value for one of the vertical bars is not available ?

Please let us know your view on this. Hope this will clarify our exact problem. If you provide code sample for this, it would be great help.

Thanks in advance,
Kinnar





0
Peshito
Telerik team
answered on 27 Sep 2012, 01:07 PM
Hello Kinnar,

Thank you for your detailed explanation of the problem.

Unfortunately removing the empty space between bars in a scenario like yours is not possible. Having null or no values for some of your series items will result in not drawing them but the space will appear.

All the best,
Peshito
the Telerik team

Time to cast your vote for Telerik! Tell DevPro Connections and Windows IT Pro why Telerik is your choice. Telerik is nominated in a total of 25 categories.

Tags
Chart
Asked by
Kinnar
Top achievements
Rank 1
Answers by
Peshito
Telerik team
Kinnar
Top achievements
Rank 1
Share this question
or