Multilevel Axis Labels

Hello
I am trying to produce a chart like the one shown below. When I look at the documentation it indicates that multi-level axes labels are possible, but then all the examples are of fixed multi-levels defined in the razor (i.e. First half of Year, Second Half of Year)
Want I want is something similar to the way a pivot chart would show data for multiple row dimensions expanded. So if my data looks like this:


Is it possible to produce the chart below.
Many thanks



6 Replies 1 reply marked as answer

SM Srihari Muthukaruppan Syncfusion Team November 18, 2020 07:21 AM UTC

Hi Ditchford, 
 
We have analysed your query. Based on your requirement we have prepared a sample for your reference with multilevel Labels based on the provided datasource. Please find the sample, code snippet and screenshot below. 
 
 
Code Snippet: 
<SfChart Title="Olympic Medals" Width="650"> 
    <ChartPrimaryXAxis ValueType="Syncfusion.Blazor.Charts.ValueType.Category" LabelRotation="90"> 
        <ChartAxisLabelBorder Type="BorderType.Rectangle"></ChartAxisLabelBorder> 
        <ChartMultiLevelLabels> 
            <ChartMultiLevelLabel> 
                <ChartCategories> 
                    <MultiLevelLabelsPrimaryXAxisCategories> 
                        <ChartCategory Start="-0.5" End="2.5" Text="In Season"> 
                        </ChartCategory> 
                        <ChartCategory Start="2.5" End="5.5" Text="Out of Season"> 
                        </ChartCategory> 
                    </MultiLevelLabelsPrimaryXAxisCategories> 
                </ChartCategories> 
                <ChartMultilevelLabelFont Color="Red"></ChartMultilevelLabelFont> 
                <ChartMultilevelLabelBorder Type="BorderType.Rectangle"> 
                </ChartMultilevelLabelBorder> 
            </ChartMultiLevelLabel> 
        </ChartMultiLevelLabels> 
    </ChartPrimaryXAxis> 
    <ChartSeriesCollection> 
        <ChartSeries DataSource="@FruitDetails" XName="Fruit" YName="ItemCount" Type="ChartSeriesType.Column"> 
        </ChartSeries> 
    </ChartSeriesCollection> 
</SfChart> 
 
@code{ 
 
    public int start = 0, end = 30; 
    public class Produce 
    { 
        public string Fruit; 
        public string Status; 
        public double ItemCount; 
    } 
    public List<Produce> FruitDetails = new List<Produce> 
    { 
            new Produce { Fruit= "Grapes ", ItemCount= 28, Status = "In Season" }, 
            new Produce { Fruit= "Apple ",  ItemCount= 50, Status = "In Season" }, 
            new Produce { Fruit= "Pears ",  ItemCount= 39, Status = "In Season" }, 
            new Produce { Fruit= "Grapes", ItemCount= 23, Status = "Out of Season" }, 
            new Produce { Fruit= "Apple",  ItemCount= 33, Status = "Out of Season" }, 
            new Produce { Fruit= "Pears",  ItemCount= 10, Status = "Out of Season" }, 
    }; 
} 
 
Screenshot: 
 
 
Let us know if you have any concerns. 
 
Regards, 
Srihari

Marked as answer

DI Ditchford November 18, 2020 10:56 PM UTC

Hello
I think we have a slight misunderstanding. The method shown is the same as in the documentation (and not what I require). This method is really just a way of drawing boxes on the x axis and filling them with a label? What I need is something to actually chart the Status as well as the Fruit and Item count.
In the example shown it just so happens that 50% of my data falls into 'In Season' and 50% into 'Out of Season'. My data (like any data) is dynamic so when I have 10% in season then your method will not correctly display the categorizations. I guess I could dynamically assemble the razor based on the data, but this seems very long winded / hacky.
I am assuming that real dynamic (bound) Multi-Axis plotting (rather than labelling) is not possible? If that is the case then that is fine. I just need to know.
Many thanks


SS Sarasilmiya Shahul Hameed Syncfusion Team November 19, 2020 05:07 AM UTC

From: Richard Grieveson
Sent: Wednesday, November 18, 2020 5:59 PM
To: Syncfusion Support
Subject: RE: Syncfusion support community forum comment 159832, Multilevel Axis Labels, has been edited.
 
Hello 
 
Whilst submitting this I got the following error.  I have seen this a few times recently.  To work-around I had to create the reply with a short amount of text and then edit. 
 
Something is amiss with your validation 
 
 
 



SM Srihari Muthukaruppan Syncfusion Team November 19, 2020 12:53 PM UTC

Hi Ditchford, 
 
Sorry for the inconvenience. 
 
We have analysed your query. From that, we would like to let you know as of now it is not possible to dynamically plot the multiple Axis labels. 
 
And regarding the error thrown while updating in incident. You have faced the forum submission issue due to the word "season" and now we have fixed it. And you can able to contact us using these words. 
 
Let us know if you have any concerns. 
 
Regards, 
Srihari M 



DI Ditchford November 24, 2020 10:51 PM UTC

Ok thanks anyway


SM Srihari Muthukaruppan Syncfusion Team November 25, 2020 06:35 AM UTC

Hi Ditchford,  
 
Most welcome. Kindly get in touch with us, if you requires further assistance. We are always happy in assisting you.   
   
Thanks,   
Srihari M 


Loader.
Up arrow icon