Issue with rendering the graph
See original GitHub issue@beto-rodriguez Hi I installed the beta release 2.0.0-beta.32
And tried out the below code, but the graph is not visible. What am I missing? *.xaml
<Page x:Class="Test.LVC2"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Test"
xmlns:lvc2="clr-namespace:LiveChartsCore.SkiaSharpView.WPF;assembly=LiveChartsCore.SkiaSharpView.WPF"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"
Title="LVC2">
<Grid>
<lvc2:CartesianChart Name="LVC2_Chart" Series="{Binding Series}"></lvc2:CartesianChart>
</Grid>
</Page>
*.xaml.cs
using LiveChartsCore;
using LiveChartsCore.SkiaSharpView;
namespace Test
{
public partial class LVC2 : Page
{
public IEnumerable<ISeries> Series ;
public LVC2()
{
InitializeComponent();
Series= new ObservableCollection<ISeries>
{
new LineSeries<double>
{
Values = new ObservableCollection<double> { 2, 1, 3, 5, 3, 4, 6 },
Fill = null
}
}
}
}
}
And from main window, on tab change event, I do the following
if (LVC2Tab.IsSelected)
ContentFrame.NavigationService.Navigate(new LVC2());
Issue Analytics
- State:
- Created 2 years ago
- Comments:14 (6 by maintainers)
Top Results From Across the Web
Problem when rendering graphs - Maybe a bug
I have developed a COVID-19 web app and I realized that on the “Forecasting” tab it renders the Total Cases graph but when...
Read more >has anyone else been having trouble w/ their graph view ...
I used to have issues with the graph, i found it was the Persistent Graph plugin that was causing it. I uninstalled and...
Read more >Error rendering the graph on DOM. #408 - dagrejs/dagre-d3
var svg = d3.select('svg'); var inner = svg.select('g'); var graphRender = new dagreD3.render();. the line of code that is issuing this error:.
Read more >Issue while rendering d3 graph in html page
I am trying to render d3 graph with html, when i open the page in laptop browser it's working perfect, But when i...
Read more >Problem with rendering graph - Oracle Forums
Hi OTN, In my ADF BC application I have a requirement of displaying data in a barGraph. Also I need to apply some...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Ohhh ok I see It. At first I didnt pay attention to your Series field. And thats the reason. Its a field but need to be property! Here you can find more information about difference between fields and properties: LINK
Just to be clear: Its not at all related to LiveCharts library. Its related to C#, WPF and its binding mechanism. Basically if you want binding to work you need to use property instead of a field. So instead of:
public IEnumerable<ISeries> Series;
it should rather be:
public IEnumerable<ISeries> Series {get; set;}
Then everything works fine 😃 However you can still have it working with a field but then you need to use reference to control. Example below:
BTW: sometimes binding might be tricky but Visual Studio introduced nice feature helping people get around it.
This red icon at the top of the image tells you that you have a problem with binding somewhere. Just click it to get more information.
Good luck!
You are not setting datacontext for your binding as far as I see