Search code examples
chartsshieldui

Any way to set PrimaryHeader from codebehind in ShieldUi BarChart


I am using the asp.net version of shieldui for charts and have a barchart and would like to set the primaryHeader or secondaryHeader with data from the database. I searched the documentation page of shieldui website and could not find anything.

What I tried is something like this:

<shield:ShieldChart ID="ShieldChart1" Width="100%" Height="200px" runat="server"
    OnTakeDataSource="ShieldChart1_TakeDataSource"
    CssClass="chart">
    <PrimaryHeader Text=" ">
        <Style Bold="true" FontSize="30px" />
    </PrimaryHeader>
    <SecondaryHeader Text="<asp:Label id="CardInvoiced" runat="server"/> ">
    </SecondaryHeader>
    <ExportOptions AllowExportToImage="false" AllowPrint="false" />
    <Axes>
        <shield:ChartAxisX 
            CategoricalValuesField="Area">
        </shield:ChartAxisX> 
        <shield:ChartAxisY>

        </shield:ChartAxisY>
    </Axes>
    <DataSeries>
            <shield:ChartBarSeries DataFieldY="Sales" CollectionAlias="signups">
            </shield:ChartBarSeries>
            <shield:ChartBarSeries DataFieldY="Starts" CollectionAlias="starts">
            </shield:ChartBarSeries>
            <shield:ChartBarSeries DataFieldY="bis" CollectionAlias="bis">
            </shield:ChartBarSeries>
            <shield:ChartBarSeries DataFieldY="comps" CollectionAlias="comps">
            </shield:ChartBarSeries>
    </DataSeries>
</shield:ShieldChart>

ShieldUI error is:

Type 'Shield.Web.UI.ShieldChart' does not have a public property named 'Label'.

Any suggestion on how to accomplish this?


Solution

  • I solved this and here is how you set both PrimaryHeader and SecondaryHeader in ShieldUi graphs:

        ShieldChartFSS7R.PrimaryHeader.Text = "Test Primary Header";
        ShieldChartFSS7R.SecondaryHeader.Text = "Test Secondary Header";
    

    Which shows the headers like this:

    header example