Chart Background Not Working on DataSource Read

3 posts, 0 answers
  1. Bill
    Bill avatar
    2 posts
    Member since:
    Feb 2016

    Posted 29 Feb Link to this post

    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. Bill
    Bill avatar
    2 posts
    Member since:
    Feb 2016

    Posted 29 Feb Link to this post

    After some more investigation it is actually the plot area that is affected, not the chartarea.
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Iliana Nikolova
    Admin
    Iliana Nikolova avatar
    2592 posts

    Posted 02 Mar Link to this post

    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
Back to Top