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

HIde Column Series when value is zero

4 Answers 383 Views
Chart (HTML5)
This is a migrated thread and some comments may be shown as answers.
Wired_Nerve
Top achievements
Rank 2
Wired_Nerve asked on 09 Jun 2015, 08:26 PM

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>

4 Answers, 1 is accepted

Sort by
0
Wired_Nerve
Top achievements
Rank 2
answered on 09 Jun 2015, 08:40 PM

Something like this would be cool...

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

 

 

0
Marin Bratanov
Telerik team
answered on 11 Jun 2015, 01:51 PM

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
0
Wired_Nerve
Top achievements
Rank 2
answered on 11 Jun 2015, 01:56 PM

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... ???

 

0
Marin Bratanov
Telerik team
answered on 11 Jun 2015, 02:12 PM

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
Tags
Chart (HTML5)
Asked by
Wired_Nerve
Top achievements
Rank 2
Answers by
Wired_Nerve
Top achievements
Rank 2
Marin Bratanov
Telerik team
Share this question
or