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

Chart Background Not Working on DataSource Read

2 Answers 62 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Bill
Top achievements
Rank 1
Bill asked on 29 Feb 2016, 02:53 PM

Every time the chart is drawn the background is set to gray. No matter if the theme is specified or not or if the chart area background is set to "", "transparent" or any color, or not at all.

You can see a blank chart with the correct background color prior to the read occurring and the chart being redrawn with the appropriate data. Each path element in the SVG has a stroke color set to "#dfdfdf"

Here is the code:

@(Html.Kendo( ).Chart<ViewModels.HistoryChartModel>( )
.Name( "chart" )
.ChartArea(c=>c.Width(800).Height(600))
.DataSource( dataSource => dataSource
    .Read( read => read.Action( "Series", "Home" ) )
    .Group( group => group.Add( model => model.BasinName ) )
    .Sort( sort => sort.Add( model => model.ReadingDateTime ).Descending( ))
)
.Series( series => {series.Line( model => model.LevelReading ).Name( "#= group.value # " ).Markers(false);} )
.Legend( legend => legend.Position( ChartLegendPosition.Bottom ))
.ValueAxis( a => a.Numeric( ).Min( 3 ).Max(10).MinorTicks(mt=>mt.Visible(false)).MajorUnit(.5) )
)

2 Answers, 1 is accepted

Sort by
0
Bill
Top achievements
Rank 1
answered on 29 Feb 2016, 07:15 PM
After some more investigation it is actually the plot area that is affected, not the chartarea.
0
Iliana Dyankova
Telerik team
answered on 02 Mar 2016, 09:35 AM
Hi Bill,

I posted a reply in your other thread on the same subject (1014683), however I am pasting my answer here too so the other users who are folling this thread can read it: 

Generally speaking, the chartArea background comes from the selected theme (if not explicitly set). If I am right, you are using the Silver theme? In order to avoid the gray background I would suggest the following options: 
- Set a different theme to the chart: 
//....
.Theme("Default")

- Set chartArea / plotArea backgrounds: 
//....
.ChartArea(c=>c.Width(800).Height(600).Background("red"))
.PlotArea(c=>c.Background("yellow"))

If these suggestions does not help please provide an isolated runnable example which I could test locally - this way I would be able to check what exactly is going wrong and provide concrete recommendations.


Regards,
Iliana Nikolova
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
Asked by
Bill
Top achievements
Rank 1
Answers by
Bill
Top achievements
Rank 1
Iliana Dyankova
Telerik team
Share this question
or