// 1. temp high
ViewAnnotation annotation_top = new ViewAnnotation()
{
X1 = x,
Y1 = c.FValue_High + 0.25,
VerticalAlignment = ChartAnnotationAlignment.Start,
};
TextView textView_high = new TextView(_context);
textView_high.Text = c.Value + "°";
textView_high.SetTypeface(Helper_Text.GetFont_ChartMarker(), TypefaceStyle.Normal);
textView_high.TextSize = 12;
textView_high.SetTextColor(Convertor_Colour_Droid.convert(Helper_Colour_Droid.GetText()));
LinearLayout linearLayout = new LinearLayout(_context);
linearLayout.Orientation = Orientation.Vertical;
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.MatchParent);
layoutParams.SetMargins(0, 0, 0, 0);
linearLayout.LayoutParameters = layoutParams;
linearLayout.AddView(textView_high);
annotation_top.View = linearLayout;
_chart.Annotations.Add(annotation_top);
// 2. icon
double y_pt = y_pt = c.Value + c.Value_Low;
double x_pt = x;
y_pt = (y_pt / 2);
x_pt = x;
ViewAnnotation annotation_ctr = new ViewAnnotation()
{
X1 = x_pt,
Y1 = y_pt,
VerticalAlignment = ChartAnnotationAlignment.Center,
};
LinearLayout linearLayout2 = new LinearLayout(_context);
linearLayout2.Id = x;
AppCompatImageView icon = new AppCompatImageView(_context);
icon.SetImageResource(Convertor_Icon_Droid.parseXS(c._data.IconDuo));
linearLayout2.Orientation = Orientation.Vertical;
linearLayout2.SetPadding(5, 5, 5, 5);
layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.MatchParent);
layoutParams.SetMargins(0, 0, 0, 0);
linearLayout2.LayoutParameters = layoutParams;
linearLayout2.AddView(icon);
linearLayout2.Click += CardView_Click;
//linearLayout2.LongClick += CardView_Hold;
annotation_ctr.View = linearLayout2;
_chart.Annotations.Add(annotation_ctr);
// 3. temp low
ViewAnnotation annotation_btm = new ViewAnnotation()
{
X1 = x,
Y1 = c.FValue_Low - 0.45,
VerticalAlignment = ChartAnnotationAlignment.End,
};
TextView textView_low = new TextView(_context);
textView_low.Text = c.Value_Low + "°";
textView_low.SetTypeface(Helper_Text.GetFont_ChartMarker(), TypefaceStyle.Normal);
textView_low.TextSize = 12;
textView_low.SetTextColor(Convertor_Colour_Droid.convert(Helper_Colour_Droid.GetText()));
LinearLayout linearLayout3 = new LinearLayout(_context);
linearLayout3.Orientation = Orientation.Vertical;
layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.MatchParent);
layoutParams.SetMargins(0, 0, 0, 0);
linearLayout3.LayoutParameters = layoutParams;
linearLayout3.AddView(textView_low);
annotation_btm.View = linearLayout3;
_chart.Annotations.Add(annotation_btm);
Each icon is an Android xml vector.
Also, if it helps here is the range column series setup:
_barSeries = new RangeColumnSeries();
if( Settings_Droid.theme() == "dark" || Settings_Droid.theme() == "black" )
_barSeries.Color = Convertor_Colour_Droid.convert(appyweather.Droid.Resource.Color.dchart_bar);
else
_barSeries.Color = Convertor_Colour_Droid.convert(appyweather.Droid.Resource.Color.lchart_bar);
_barSeries.CornerRadius = new ChartCornerRadius(4.0f);
_barSeries.DataPointSelectionEnabled = false;
_barSeries.High = "FValue_High";
_barSeries.ItemsSource = _card.Chart;
_barSeries.Low = "FValue_Low";
if (Settings_Droid.theme() == "dark" || Settings_Droid.theme() == "black")
_barSeries.SelectedDataPointColor = Convertor_Colour_Droid.convert(appyweather.Droid.Resource.Color.dchart_bar);
else
_barSeries.SelectedDataPointColor = Convertor_Colour_Droid.convert(appyweather.Droid.Resource.Color.lchart_bar);
_barSeries.Spacing = 0.15;
_barSeries.StrokeWidth = 0;
_barSeries.StrokeColor = Color.Red;
_barSeries.Width = 0.85;
_barSeries.XBindingPath = "Time";
And the category axis setup:
_axis_primary = new CategoryAxis();
_axis_primary.AxisLineOffset = 0;
_axis_primary.LabelRotationAngle = -55;
_axis_primary.LabelStyle.StrokeWidth = 0;
_axis_primary.LineStyle.StrokeWidth = 0;
_axis_primary.LabelStyle.TextColor = Convertor_Colour_Droid.convert(Helper_Colour_Droid.GetText("subtle"));
_axis_primary.LabelStyle.TextSize = 12;
_axis_primary.LabelStyle.Typeface = Helper_Text.GetFont_ChartMarker();
_axis_primary.MajorGridLineStyle.StrokeWidth = 0;
_axis_primary.MajorTickStyle.TickSize = 0;
_axis_primary.ShowMajorGridLines = false;
Hope you are able to assist! Thanks for your continued support.
Hi Bardi Golriz,Thanks for your update.We will wait unit hear from you.Regards,
Hemalatha M.
ViewAnnotation annotation_ctr = new ViewAnnotation()
{
X1 = x_pt,
Y1 = y_pt,
VerticalAlignment = ChartAnnotationAlignment.Center,
};
ImageView icon = new ImageView(_context);
icon.SetImageResource(Resource.Drawable.clear);
icon.Click += CardView_Click;
icon.Id = x;
annotation_ctr.View = icon;
_chart.Annotations.Add(annotation_ctr);
Also here's the clear drawable example I'm using (keep in mind, each day can have a different drawable set based on the weather but they are all similar to below):
android:viewportWidth="18" android:viewportHeight="18" android:width="18dp" android:height="18dp"> android:pathData="M16.911 9A7.911 7.911 0 0 1 1.089 9A7.911 7.911 0 0 1 16.911 9Z" android:fillType="evenOdd" android:fillColor="#FFC107" android:strokeColor="#FFB300" android:strokeWidth="2.18" android:strokeLineJoin="round" android:strokeMiterLimit="1.41421" />
I've attached it too.
In your documentation for annotations, you do have an example with an ImageView added to a ViewAnnotation, so I'm assuming what I'm doing should work fine, especially considering there are not many icons and they're quite small in size too (being vector drawables).
Looking forward to your help. Thanks so much again for the support so far.
Hi Bardi Golriz,Thanks for your update.We will wait unit hear from you.Regards,
Hemalatha M.
Okay, some positive developments to report.I changed the top and bottom ViewAnnotation's to TextAnnotations, but can't change my middle annotation as it contains a xml drawable.What I discovered is that it's the middle ViewAnnotation causing the jerky scroll. If I don't add it, then everything seems okay. So much so, there is actually no HWUI rendering happening at all in this situation i.e. their bars remain still.This is the code for the middle annotation (I streamlined it compared to what I posted originally to no longer put an ImageView inside a LinearLayout but just be an ImageView but this made no difference):ViewAnnotation annotation_ctr = new ViewAnnotation()
{
X1 = x_pt,
Y1 = y_pt,
VerticalAlignment = ChartAnnotationAlignment.Center,
};
ImageView icon = new ImageView(_context);
icon.SetImageResource(Resource.Drawable.clear);
icon.Click += CardView_Click;
icon.Id = x;
annotation_ctr.View = icon;
_chart.Annotations.Add(annotation_ctr);
Also here's the clear drawable example I'm using (keep in mind, each day can have a different drawable set based on the weather but they are all similar to below):
android:viewportWidth="18"
android:viewportHeight="18"
android:width="18dp"
android:height="18dp">
android:pathData="M16.911 9A7.911 7.911 0 0 1 1.089 9A7.911 7.911 0 0 1 16.911 9Z"
android:fillType="evenOdd"
android:fillColor="#FFC107"
android:strokeColor="#FFB300"
android:strokeWidth="2.18"
android:strokeLineJoin="round"
android:strokeMiterLimit="1.41421" />
I've attached it too.
In your documentation for annotations, you do have an example with an ImageView added to a ViewAnnotation, so I'm assuming what I'm doing should work fine, especially considering there are not many icons and they're quite small in size too (being vector drawables).
Looking forward to your help. Thanks so much again for the support so far.
|
Windows:
Follow the below link to clear cache,
For Mac
• ~/.local/share/NuGet/Cache
• ~/.nuget/package |
Hi Bardi Golriz,As promised earlier, surely we will include this fix in our upcoming July 28,2020 rolled out weekly NuGet releaseRegards,Ramya S
Hi Bardi Golriz,Thanks for your update.Please let us know if you would require any further assistance.Regards,Ramya S