We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Chart with secondary axis

I am creating a Column_clustered chart that looks like this:

When looking at the Series Options, it says Plot Series on Secondary Axis, as expected:

When selecting Primary Axis, then again Secondary Axis, the graph in Word now looks like


With the series tick marks displayed on the secondary axis as expected. How can I get this using DocIo?

Below the code I used:
 // Creates a new chart series with the name “Norm" and format serie.
                    IOfficeChartSerie barNorm = chart.Series.Add("Norm", OfficeChartType.Line);
                    barNorm.Values = chart.ChartData[1, 3, scoreRetestResults.Count + 1, 3];
                    barNorm.SerieFormat.LineProperties.LineColor = Color.FromArgb(102, 153, 204);
                    barNorm.SerieFormat.LineProperties.LineWeight = OfficeChartLineWeight.Medium;

                    barNorm.UsePrimaryAxis = false;

                    chart.SecondaryValueAxis.TickLabelPosition = OfficeTickLabelPosition.TickLabelPosition_High;
                    chart.SecondaryValueAxis.MaximumValue = normTxts[normTxts.Count - 1].NormId ;
                    chart.SecondaryValueAxis.MajorTickMark = OfficeTickMark.TickMark_Outside;

                    chart.SecondaryValueAxis.MinimumValue = 1;
                    chart.PrimaryValueAxis.MinimumValue = 0;

Thanks for any help,
Pieter


8 Replies

RH Ramanan  Hariharasubramanian Syncfusion Team August 7, 2017 02:23 PM UTC

Hi Pieter,

Thank you for contacting Syncfusion support.

By using
MaximumValue  and MinimumValue property of SecondaryValueAxis in chart, you can achieve your requirement. Please find the code example to display the serie ticks mark as expected. 
// Sets MaximumValue of SecondaryValueAxis
chart.SecondaryValueAxis.MaximumValue = 10;
// Sets MinimumValue of SecondaryValueAxis
chart.SecondaryValueAxis.MinimumValue = 0;
// Sets MajorUnit of SecondaryValueAxis
chart.SecondaryValueAxis.MajorUnit = 2; 
           
Please let us know if you have any concerns.

Regards,
Ramanan H.




PV Pieter van Kampen August 7, 2017 07:51 PM UTC

Thanks Ramanan,

unfortunately that does not change it. I have attached a sample app (the same from the date issue). It produces this result:


Can it be a bug in the Portable package?


Attachment: Generate_DocDates_c2c38e.zip


RH Ramanan  Hariharasubramanian Syncfusion Team August 8, 2017 09:26 AM UTC

Hi Pieter,

Thank you for your update.

On analyzing the given sample, we found that suggested code changes in our previous update was not available. So, we request you to apply the following code changes in your application to resolve this issue.
 
// Sets MaximumValue of SecondaryValueAxis
chart.SecondaryValueAxis.MaximumValue = 10;
// Sets MinimumValue of SecondaryValueAxis
chart.SecondaryValueAxis.MinimumValue = 0;
// Sets MajorUnit of SecondaryValueAxis
chart.SecondaryValueAxis.MajorUnit = 2; 

Can it be a bug in the Portable package?
No, it is not a bug. We have tried your requirement with Portable package and share the sample for your reference which can be downloaded from the following location.

Sample link:
 http://www.syncfusion.com/downloads/support/forum/131969/ze/ChartProject-1182619306

Please let us know if you have any concerns.

Regards,
Ramanan H.



PV Pieter van Kampen August 8, 2017 09:57 AM UTC

Thank you for your patience.

I have this in my sample:

           // Sets MaximumValue of SecondaryValueAxis.
            chart.SecondaryValueAxis.MaximumValue = 9;
            // Sets MinimumValue of SecondaryValueAxis.
            chart.SecondaryValueAxis.MinimumValue = 1;
            // Sets MajorUnit of SecondaryValueAxis.
            chart.SecondaryValueAxis.MajorUnit = 2;

Which is pretty much the same. But also with your indicated code values 10 and 0  I get the same result.

Unfortunately there is an issue with your uploaded sample, it is not complete, their is no code included. Can you have a look please and provide another link, so I can try it?



PV Pieter van Kampen August 8, 2017 03:34 PM UTC

Here is a screenshot with the suggest code and the result

Regards

Pieter