I am trying to do a chart like the demos where it has the months along the bottom jan to dec and then in the verticial it has weights
However I cannot for the life of me see how to change this color as u see below the vaules in the verticle side are way to hard to see. their like a gray on black
This is what I have so far
```
<chart:SfChart BackgroundColor="Black" Grid.Row="1" MinimumHeightRequest="600" x:Name="performanceChart">
<chart:SfChart.Legend>
<chart:ChartLegend StrokeColor="Black" CornerRadius="5" StrokeWidth="2"
BackgroundColor="#f5f5f0" Margin="5">
<chart:ChartLegend.StrokeDashArray>
</chart:ChartLegend.StrokeDashArray>
<chart:ChartLegend.LabelStyle>
<chart:ChartLegendLabelStyle TextColor="Blue" Margin="5" FontSize="18" FontAttributes="Bold"/>
</chart:ChartLegend.LabelStyle>
</chart:ChartLegend>
</chart:SfChart.Legend>
<chart:SfChart.PrimaryAxis>
<chart:CategoryAxis >
<chart:CategoryAxis.Title>
<chart:ChartAxisTitle Text="Month" TextColor="Red" FontSize="20" FontAttributes="Bold"/>
</chart:CategoryAxis.Title>
</chart:CategoryAxis>
</chart:SfChart.PrimaryAxis>
<chart:SfChart.SecondaryAxis >
<chart:NumericalAxis Minimum="10" Maximum="100" ShowMinorGridLines="True" MinorTicksPerInterval="1">
<chart:NumericalAxis.MajorTickStyle >
<chart:ChartAxisTickStyle TickSize="7" StrokeColor="Red" StrokeWidth="3"/>
</chart:NumericalAxis.MajorTickStyle>
<chart:NumericalAxis.MinorTickStyle>
<chart:ChartAxisTickStyle TickSize="5" StrokeColor="Green" StrokeWidth="2"/>
</chart:NumericalAxis.MinorTickStyle>
</chart:NumericalAxis>
</chart:SfChart.SecondaryAxis>
<chart:SfChart.ChartBehaviors>
<chart:ChartZoomPanBehavior EnableSelectionZooming="True"/>
</chart:SfChart.ChartBehaviors>
</chart:SfChart>
My Code behind for my model
public void BindData()
{
SfChart chart = new SfChart();
TBData = new ObservableCollection<ChartDataPoint>();
TBData.Add(new ChartDataPoint("Jan", 32));
TBData.Add(new ChartDataPoint("Feb", 42));
TBData.Add(new ChartDataPoint("Mar", 32));
TBData.Add(new ChartDataPoint("Apr", 42));
TBData.Add(new ChartDataPoint("May", 44));
TBData.Add(new ChartDataPoint("Jun", 33));
TBData.Add(new ChartDataPoint("Jul", 42));
TBData.Add(new ChartDataPoint("Aug", 34));
TBData.Add(new ChartDataPoint("Sep", 60));
TBData.Add(new ChartDataPoint("OCT", 40));
TBData.Add(new ChartDataPoint("NOV", 30));
TBData.Add(new ChartDataPoint("DEC", 42));
var line1 = new LineSeries()
{
ItemsSource = TBData,
Label = "Trap Bar",
Color = Color.FromHex("#01a79f"),
DataMarker = new ChartDataMarker()
{
ShowLabel = false,
ShowMarker = true,
MarkerHeight = 10,
MarkerWidth = 10,
MarkerColor = Color.Green
}
};
BPData = new ObservableCollection<ChartDataPoint>();
BPData.Add(new ChartDataPoint("Jan", 12));
BPData.Add(new ChartDataPoint("Feb", 32));
BPData.Add(new ChartDataPoint("Mar", 42));
BPData.Add(new ChartDataPoint("Apr", 32));
BPData.Add(new ChartDataPoint("May", 54));
BPData.Add(new ChartDataPoint("Jun", 23));
BPData.Add(new ChartDataPoint("Jul", 32));
BPData.Add(new ChartDataPoint("Aug", 44));
BPData.Add(new ChartDataPoint("Sep", 50));
BPData.Add(new ChartDataPoint("OCT", 60));
BPData.Add(new ChartDataPoint("NOV", 70));
BPData.Add(new ChartDataPoint("DEC", 82));
var line2 = new LineSeries()
{
ItemsSource = BPData,
Label = "Bench Press",
Color = Color.Black,
DataMarker = new ChartDataMarker()
{
ShowLabel = false,
ShowMarker = true,
MarkerHeight = 10,
MarkerWidth = 10,
MarkerColor = Color.Blue
}
};
OHPData = new ObservableCollection<ChartDataPoint>();
OHPData.Add(new ChartDataPoint("Jan", 42));
OHPData.Add(new ChartDataPoint("Feb", 36));
OHPData.Add(new ChartDataPoint("Mar", 45));
OHPData.Add(new ChartDataPoint("Apr", 40));
OHPData.Add(new ChartDataPoint("May", 54));
OHPData.Add(new ChartDataPoint("Jun", 26));
OHPData.Add(new ChartDataPoint("Jul", 32));
OHPData.Add(new ChartDataPoint("Aug", 44));
OHPData.Add(new ChartDataPoint("Sep", 54));
OHPData.Add(new ChartDataPoint("OCT", 66));
OHPData.Add(new ChartDataPoint("NOV", 74));
OHPData.Add(new ChartDataPoint("DEC", 32));
var line3 = new LineSeries()
{
ItemsSource = OHPData,
Label = "Over Head Press",
Color = Color.Orange,
DataMarker = new ChartDataMarker()
{
ShowLabel = false,
ShowMarker = true,
MarkerHeight = 5,
MarkerWidth = 5,
MarkerColor = Color.Orange
}
};
performanceChart.PrimaryAxis = new DateTimeAxis()
{
IntervalType = DateTimeIntervalType.Months,
Interval = 12,
};
performanceChart.Series.Add(line1);
performanceChart.Series.Add(line2);
performanceChart.Series.Add(line3);
Also I am not displaying the months along the bottom as they should do please help
|
<chart:SfChart.PrimaryAxis>
<chart:CategoryAxis>
<chart:CategoryAxis.LabelStyle>
<chart:ChartAxisLabelStyle TextColor="#f5f5f0"/>
</chart:CategoryAxis.LabelStyle>
<chart:CategoryAxis.Title>
<chart:ChartAxisTitle Text="Month" TextColor="Red" FontSize="20" FontAttributes="Bold"/>
</chart:CategoryAxis.Title>
</chart:CategoryAxis>
</chart:SfChart.PrimaryAxis>
<chart:SfChart.SecondaryAxis >
<chart:NumericalAxis Minimum="10" Maximum="100" ShowMinorGridLines="True" MinorTicksPerInterval="1">
…
<chart:NumericalAxis.LabelStyle>
<chart:ChartAxisLabelStyle TextColor="#f5f5f0"/>
</chart:NumericalAxis.LabelStyle>
</chart:NumericalAxis>
</chart:SfChart.SecondaryAxis> |
|
|
Hi THAT is great but what about the font size on the axis can this be changed at all?
First class support from Syncfusion as always
|
<chart:SfChart.PrimaryAxis>
<chart:CategoryAxis>
<chart:CategoryAxis.LabelStyle>
<chart:ChartAxisLabelStyle TextColor="#f5f5f0" FontSize="15"/>
</chart:CategoryAxis.LabelStyle>
<chart:CategoryAxis.Title>
<chart:ChartAxisTitle Text="Month" TextColor="Red" FontSize="20" FontAttributes="Bold"/>
</chart:CategoryAxis.Title>
</chart:CategoryAxis>
</chart:SfChart.PrimaryAxis>
|
I need to construct my chart data in a web api project but the problem I have is that ChartDataPoint is stored in
Syncfusion.SfChart.XForms is their a way I can safely access ChartDataPoint class from my asp.net web api layer at all?
|
<chart:LineSeries ItemsSource="{Binding Demands}"
XBindingPath="Demand"
YBindingPath="Year2010"/> |
|
[C#]
public class MonthDemand
{
public MonthDemand(string demand, double year2010, double year2011)
{
this.Demand = demand;
this.Year2010 = year2010;
this.Year2011 = year2011;
}
public string Demand { get; set; }
public double Year2010 { get; set; }
public double Year2011 { get; set; }
}
public class DataModel
{
public ObservableCollection<MonthDemand> Demands{ get; set; }
public DataModel ()
{
Demands = new ObservableCollection<MonthDemand>();
Demands.Add(new MonthDemand("Jan", 42, 27));
Demands.Add(new MonthDemand("Feb", 44, 28));
Demands.Add(new MonthDemand("Mar", 53, 35));
Demands.Add(new MonthDemand("Apr", 64, 44));
Demands.Add(new MonthDemand("May", 75, 54));
Demands.Add(new MonthDemand("Jun", 83, 63));
}
} |