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

Radchart Empty value feature

3 Answers 150 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Peeyush
Top achievements
Rank 1
Peeyush asked on 29 Nov 2011, 11:45 AM
I am using Rad chart in which i am allocating the datasource as dataset that is created dynamically through an xml file, what i want is when there is no record found for particular data it shows null(zero),i want to smooth the graph according to the dynamic data ie. graph should not break in between it should be smooth, i tried implimenting empty value property but was of no help, i think i am not able to get it right. I have attached a screenshot that demonstrates my problem related to null records(zero), though its not that similar i just want to remove in between zero or null value issue.

Thanks
Peeyush Pandey
<telerik:RadChart ID="draw_graph" runat="server" Style="margin-top: -21px; margin-left: 3px;"
    Height="500px" Width="1180px" Skin="LightGreen" AutoLayout="true">
    <PlotArea>
        <XAxis MaxValue="5" MinValue="1" Step="1" LayoutMode="normal" DataLabelsColumn="Name">
            <Appearance Color="182, 182, 182" MajorTick-Color="216, 216, 216">
                <MajorGridLines Color="216, 216, 216" PenStyle="Solid" />
                <TextAppearance TextProperties-Color="51, 51, 51">
                </TextAppearance>
            </Appearance>
            <AxisLabel>
                <TextBlock>
                    <Appearance TextProperties-Color="51, 51, 51">
                    </Appearance>
                </TextBlock>
            </AxisLabel>
        </XAxis>
        <YAxis>
            <Appearance Color="182, 182, 182" MajorTick-Color="216, 216, 216" MinorTick-Color="223, 223, 223">
                <MajorGridLines Color="216, 216, 216" />
                <MinorGridLines Color="223, 223, 223" />
                <TextAppearance TextProperties-Color="51, 51, 51">
                </TextAppearance>
            </Appearance>
            <AxisLabel Visible="true">
                <TextBlock Text="% ( In Percent )" Appearance-TextProperties-Color="Orange" Appearance-TextProperties-Font="Bold">
                    <Appearance TextProperties-Color="Orange" TextProperties-Font="Bold">
                    </Appearance>
                </TextBlock>
            </AxisLabel>
        </YAxis>
        <Appearance>
            <FillStyle FillType="Solid" MainColor="White">
            </FillStyle>
            <Border Color="182, 182, 182" />
        </Appearance>
    </PlotArea>
    <ChartTitle>
        <Appearance Position-AlignedPosition="Top">
            <FillStyle MainColor="">
            </FillStyle>
        </Appearance>
        <TextBlock Text="Company Analysis" Appearance-Position-AlignedPosition="Top">
            <Appearance TextProperties-Color="Black" TextProperties-Font="Arial, 12pt">
            </Appearance>
        </TextBlock>
    </ChartTitle>
    <Appearance Corners="Round, Round, Round, Round, 7">
        <FillStyle FillType="ComplexGradient">
            <FillSettings GradientMode="Horizontal">
                <ComplexGradient>
                    <telerik:GradientElement Color="236, 236, 236" />
                    <telerik:GradientElement Color="248, 248, 248" Position="0.5" />
                    <telerik:GradientElement Color="236, 236, 236" Position="1" />
                </ComplexGradient>
            </FillSettings>
        </FillStyle>
        <Border Color="130, 130, 130" />
    </Appearance>
    <Legend>
        <Appearance Overflow="Row" Position-AlignedPosition="Bottom" Dimensions-Margins="17.6%, 3%, 3px, 6px"
            Dimensions-Paddings="2px, 8px, 6px, 3px">
            <ItemMarkerAppearance Figure="Square" FillStyle-MainColor="Green">
                <Border Width="0" />
            </ItemMarkerAppearance>
            <FillStyle>
            </FillStyle>
            <Border Width="1" />
        </Appearance>
    </Legend>
</telerik:RadChart>

3 Answers, 1 is accepted

Sort by
0
Peshito
Telerik team
answered on 02 Dec 2011, 09:36 AM
Hello Peeyush,

Try hiding the zero values by wiring up to the ItemDataBount event like this:
void RadChart1_ItemDataBound(object sender, ChartItemDataBoundEventArgs e)
    {
        if (e.SeriesItem.YValue == 0)
        {
            e.SeriesItem.Label.Appearance.Visible = false;
        }
    }

In case you want to use the EmptyValue property, you need to pass your empty values as null and then set the empty value mode to Approximation like this:
line1.Appearance.EmptyValue.Mode = Telerik.Charting.Styles.EmtyValuesMode.Approximation;

More information about empty values can be found here:
http://www.telerik.com/help/aspnet-ajax/radchart-empty-values.html or you could also see our demo example.

Kind regards,
Peshito
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Peeyush
Top achievements
Rank 1
answered on 02 Dec 2011, 01:40 PM
Thanx!

But could you be more specific about setting the empty property like what is line1 in it and how can we set that programmatically?
as i have set the empty value as null but do not have idea to set the appearance of the it.

Reagrds,
Peeyush Pandey
0
Peshito
Telerik team
answered on 07 Dec 2011, 08:31 AM
Hi Peeyush,

Line1 is the instance of your serie. You can set it programmatically like this:
ChartSeries line1= new ChartSeries();
line1.Type = ChartSeriesType.Line;

line1.DataYColumn = "Value";
line1.Appearance.EmptyValue.Mode = Telerik.Charting.Styles.EmtyValuesMode.Approximation;

radChart.Series.Add(line1);

Hope this helps.

Regards,
Peshito
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
Chart (Obsolete)
Asked by
Peeyush
Top achievements
Rank 1
Answers by
Peshito
Telerik team
Peeyush
Top achievements
Rank 1
Share this question
or