How to reduce size of colored rectangle of the legends ?
- Developer Mt asked 6 years ago
- last edited 6 years ago
- You must login to post comments
Hi there,
Thanks for your question.
I believe you’re talking about LegendPointMarker. You can resize it by providing custom layout for legend item. To do this first of all you need to create custom_legend_item layout which by default look like this:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/legendItemMargin"
android:orientation="horizontal">
<CheckBox
android:id="@+id/isVisible"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textSize="@dimen/legendTextSize"
android:layout_marginLeft="@dimen/legendItemCheckBoxNegativeMargin"
android:layout_marginTop="@dimen/legendItemCheckBoxNegativeMargin"
android:layout_marginRight="@dimen/legendItemCheckBoxNegativeMargin"
android:layout_marginBottom="@dimen/legendItemCheckBoxNegativeMargin" />
<com.scichart.charting.visuals.legend.LegendPointMarker
android:id="@+id/pointMarker"
android:layout_width="@dimen/legendItemPointMarkerWidth"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_margin="@dimen/legendItemPointMarkerMargin"
android:layout_marginTop="@dimen/legendItemPointMarkerMargin" />
<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|start"
android:layout_marginEnd="@dimen/legendItemSeriesNameRightMargin"
android:layout_marginStart="@dimen/legendItemSeriesNameLeftMargin"
android:textSize="@dimen/legendTextSize"
android:textStyle="bold" />
</LinearLayout>
There you can adjust size of LegendPointMarker by changing its width and height. After that you need to create custom legend item factory which will use the layout above to create legend items:
class CustomLegendItemsFactory extends DefaultLegendItemsFactory {
@Override
protected View createLegendItemView(ViewGroup parent) {
return LayoutInflater.from(parent.getContext()).inflate(R.layout.custom_legend_item, null);
}
}
Then you need to use this factory to create LegendModifier instance:
legendModifier = new LegendModifier(legend, new SeriesInfoLegendAdapter(new CustomLegendItemsFactory()), false);
ModifierGroup modifierGroup = sciChartBuilder.newModifierGroup()
.withModifier(legendModifier)
.build();
Is this suitable for your needs?
Best regards,
Yura
- Yura Khariton answered 6 years ago
- You must login to post comments
I am considering applying server-side licensing for my javerScript application.
In the document below, there is a phrase “Our server-side licensing component is written in C++.”
(https://support.scichart.com/index.php?/Knowledgebase/Article/View/17256/42/)
However, there is only asp.net sample code on the provided github.
(https://github.com/ABTSoftware/SciChart.JS.Examples/tree/master/Sandbox/demo-dotnet-server-licensing)
I wonder if there is a sample code implemented in C++ for server-side licensing.
Can you provide c++ sample code?
Also, are there any examples to run on Ubuntu?
- Developer Mt answered 6 years ago
- You must login to post comments
Please login first to submit.