HIde Column Series when value is zero

5 posts, 0 answers
  1. Wired_Nerve
    Wired_Nerve avatar
    163 posts
    Member since:
    Oct 2007

    Posted 09 Jun 2015 Link to this post

    I have a chart that uses a linqDataSource.

    Some of the incoming data has no values.

     I need to hide the ColumnSeries if that is true..   Value == 0 ? visible = false : visible = true;

    Can someone point me to an article or such?

     

     <telerik:ColumnSeries DataFieldY="Auctioned" Name="Auctioned">
                        <Appearance>
                            <FillStyle BackgroundColor="#8dd3c7"></FillStyle>
                        </Appearance>
                        <LabelsAppearance Visible="False" Position="Center">
                        </LabelsAppearance>
                        <TooltipsAppearance Visible="True">
                            <ClientTemplate>
                                Auctioned<br/>#=value#
                            </ClientTemplate>
                        </TooltipsAppearance>
                    </telerik:ColumnSeries>

  2. Wired_Nerve
    Wired_Nerve avatar
    163 posts
    Member since:
    Oct 2007

    Posted 09 Jun 2015 in reply to Wired_Nerve Link to this post

    Something like this would be cool...

        <telerik:ColumnSeries DataFieldY="Auctioned" Name="Auctioned" Visible="#=value === 0 ?false:true #">

     

     

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3602 posts

    Posted 11 Jun 2015 Link to this post

    Hi,

    The easiest way to do this would perhaps be to examine the data on the server (e.g., loop through the list of custom data and check the field) and use the VIsible property according to your custom logic.

    The last post's suggestion cannot be implemented because:

    • this would be a client template inside a server property
    • a series has more than one item, i.e., more than one associated value, so such a simple rule cannot be used for the entire series


    Regards,

    Marin Bratanov
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  5. Wired_Nerve
    Wired_Nerve avatar
    163 posts
    Member since:
    Oct 2007

    Posted 11 Jun 2015 in reply to Marin Bratanov Link to this post

    I like the idea of "The easiest way to do this would perhaps be to examine the data on the server (e.g., loop through the list of custom data and check the field) and use the VIsible property according to your custom logic."  but where in the code do I hook into the chart building process to set the value visible to false?  CHART INIT, PRERENDER ...etc... ???

     

  6. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3602 posts

    Posted 11 Jun 2015 Link to this post

    Hello,

    The data source events should let you do that: http://demos.telerik.com/aspnet-ajax/htmlchart/examples/databinding/linqdatasource/defaultcs.aspx.

    Or, you can simply get the List<> yourself and bind it "manually" to the chart: http://demos.telerik.com/aspnet-ajax/htmlchart/examples/databinding/bindtolist/defaultcs.aspx.

    Regards,

    Marin Bratanov
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017